diff --git a/docs/.vitepress/theme/components/LiveCodeEditor.tsx b/docs/.vitepress/theme/components/LiveCodeEditor.tsx index 86afb04..3a966b8 100644 --- a/docs/.vitepress/theme/components/LiveCodeEditor.tsx +++ b/docs/.vitepress/theme/components/LiveCodeEditor.tsx @@ -1,6 +1,7 @@ import React, { useContext, useEffect, useRef } from 'react' import { LiveContext, LiveEditor } from 'react-live' +import { Flex, Tag, Text } from '@wuyangfan/nova-ui' function lineCount(code: string) { if (!code) { @@ -37,6 +38,7 @@ export function LiveCodeEditor() { const { code, language } = ctx const lines = Math.max(lineCount(code), 1) + const badge = languageBadge(language) const mainRef = useRef(null) const gutterRef = useRef(null) @@ -76,22 +78,25 @@ export function LiveCodeEditor() { }, [code]) return ( -
-
- {languageBadge(language)} -
-
- -
+ + -
-
-
+ + + ) -} +} \ No newline at end of file diff --git a/docs/.vitepress/theme/components/LivePlayground.tsx b/docs/.vitepress/theme/components/LivePlayground.tsx index c080877..a38d58c 100644 --- a/docs/.vitepress/theme/components/LivePlayground.tsx +++ b/docs/.vitepress/theme/components/LivePlayground.tsx @@ -80,8 +80,8 @@ const ReactLiveMount = defineComponent({ root.render( React.createElement( - 'div', - { className: 'live-wrap' }, + NovaUI.Flex, + { className: 'live-wrap', vertical: true }, React.createElement( LiveProvider, { @@ -90,8 +90,8 @@ const ReactLiveMount = defineComponent({ language: prismLanguage, enableTypeScript: resolveEnableTypeScript(props.language), }, - React.createElement('div', { className: 'live-pane live-preview' }, React.createElement(LivePreview, null)), - React.createElement('div', { className: 'live-pane live-editor' }, React.createElement(LiveCodeEditor, null)), + React.createElement(NovaUI.Flex, { className: 'live-pane live-preview' }, React.createElement(LivePreview, null)), + React.createElement(NovaUI.Flex, { className: 'live-pane live-editor', vertical: true }, React.createElement(LiveCodeEditor, null)), React.createElement(LiveError, { className: 'live-error' }), ), ), @@ -114,4 +114,4 @@ const ReactLiveMount = defineComponent({ }, }) -export default ReactLiveMount +export default ReactLiveMount \ No newline at end of file diff --git a/docs/.vitepress/theme/custom.css b/docs/.vitepress/theme/custom.css index 4b0558f..cad86a3 100644 --- a/docs/.vitepress/theme/custom.css +++ b/docs/.vitepress/theme/custom.css @@ -52,22 +52,28 @@ } .live-code-editor-toolbar { - display: flex; - justify-content: flex-end; - align-items: center; - padding: 6px 10px; + justify-content: space-between; + padding: 8px 12px; border-bottom: 1px solid var(--vp-c-divider); - background: var(--vp-code-block-bg, var(--vp-code-bg, var(--vp-c-bg-alt))); + background: color-mix(in srgb, var(--vp-c-bg-soft) 80%, transparent); +} + +.live-code-editor-title { + color: var(--vp-c-text-2) !important; + font-size: 12px !important; + font-weight: 600; + letter-spacing: 0.02em; } .live-code-editor-lang { - font-size: 11px; + border-color: var(--vp-c-divider) !important; + background: var(--vp-c-bg) !important; + color: var(--vp-c-text-2) !important; + font-size: 11px !important; font-weight: 600; letter-spacing: 0.06em; - color: var(--vp-c-text-3); - border: 1px solid var(--vp-c-divider); - border-radius: 6px; - padding: 2px 8px; + border-radius: 999px !important; + padding: 2px 8px !important; } .live-code-editor-main { @@ -95,8 +101,13 @@ } .live-code-editor-gutter-line { - font-size: 13px; - line-height: 1.55; + display: block; + color: var(--vp-c-text-3) !important; + font-family: + ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", + monospace !important; + font-size: 13px !important; + line-height: 1.55 !important; min-height: calc(13px * 1.55); } @@ -175,4 +186,4 @@ white-space: normal; line-height: 1.6; color: var(--vp-c-text-2); -} +} \ No newline at end of file