From fc734efa34ff12290d9db9cb8b1829cb97be8881 Mon Sep 17 00:00:00 2001 From: Gao Sun Date: Sun, 19 Mar 2023 19:32:49 +0800 Subject: [PATCH] refactor(console,phrases): polish css editor (#3508) --- .../src/components/CodeEditor/index.module.scss | 15 +++++++++++---- .../console/src/components/CodeEditor/index.tsx | 5 ++--- .../tabs/Branding/CustomCssForm.module.scss | 2 +- .../de/translation/admin-console/sign-in-exp.ts | 2 +- .../en/translation/admin-console/sign-in-exp.ts | 2 +- .../fr/translation/admin-console/sign-in-exp.ts | 2 +- .../ko/translation/admin-console/sign-in-exp.ts | 2 +- .../translation/admin-console/sign-in-exp.ts | 2 +- .../translation/admin-console/sign-in-exp.ts | 2 +- .../translation/admin-console/sign-in-exp.ts | 2 +- .../translation/admin-console/sign-in-exp.ts | 2 +- 11 files changed, 22 insertions(+), 16 deletions(-) diff --git a/packages/console/src/components/CodeEditor/index.module.scss b/packages/console/src/components/CodeEditor/index.module.scss index 521df7df3..22aa851fd 100644 --- a/packages/console/src/components/CodeEditor/index.module.scss +++ b/packages/console/src/components/CodeEditor/index.module.scss @@ -7,13 +7,21 @@ background: #34353f; position: relative; + .placeholder { + position: absolute; + inset: _.unit(6); + right: _.unit(8); + color: #95969f; + font: var(--font-body-2); + } + .copy { display: flex; align-items: center; justify-content: right; position: absolute; - top: 24px; - right: 24px; + top: _.unit(3); + right: _.unit(3); opacity: 0%; transition: opacity 0.2s ease-in-out; z-index: 1; @@ -31,7 +39,6 @@ textarea { width: 100%; - height: 100%; margin: 0; padding: 0; border: none; @@ -53,7 +60,7 @@ textarea, pre { display: flex; - min-height: 20px; + min-height: 80px; } } } diff --git a/packages/console/src/components/CodeEditor/index.tsx b/packages/console/src/components/CodeEditor/index.tsx index 571c43723..8218d011e 100644 --- a/packages/console/src/components/CodeEditor/index.tsx +++ b/packages/console/src/components/CodeEditor/index.tsx @@ -1,4 +1,3 @@ -import { conditional } from '@silverhand/essentials'; import classNames from 'classnames'; import type { ChangeEvent, KeyboardEvent } from 'react'; import { useMemo, useRef } from 'react'; @@ -69,6 +68,7 @@ const CodeEditor = ({ return ( <>
+ {!value &&
{placeholder}
}
{/* SyntaxHighlighter is a readonly component, so a transparent