diff --git a/packages/console/src/components/CodeEditor/index.module.scss b/packages/console/src/components/CodeEditor/index.module.scss index d3297f570..3ea8f51fb 100644 --- a/packages/console/src/components/CodeEditor/index.module.scss +++ b/packages/console/src/components/CodeEditor/index.module.scss @@ -1,7 +1,6 @@ @use '@/scss/underscore' as _; .editor { - margin: _.unit(1) 0; border-radius: _.unit(4); padding: _.unit(4) 0; // Use fixed color for both light and dark mode, the same as vs-dark. diff --git a/packages/console/src/components/CodeEditor/index.tsx b/packages/console/src/components/CodeEditor/index.tsx index 5a5abae24..5280d6995 100644 --- a/packages/console/src/components/CodeEditor/index.tsx +++ b/packages/console/src/components/CodeEditor/index.tsx @@ -8,7 +8,7 @@ import IconButton from '../IconButton'; import * as styles from './index.module.scss'; type Props = { - language: string; + language?: string; height?: string; isReadonly?: boolean; value?: string; diff --git a/packages/console/src/pages/GetStarted/components/Step/index.tsx b/packages/console/src/pages/GetStarted/components/Step/index.tsx index 3d29aea64..0c439398d 100644 --- a/packages/console/src/pages/GetStarted/components/Step/index.tsx +++ b/packages/console/src/pages/GetStarted/components/Step/index.tsx @@ -5,6 +5,7 @@ import ReactMarkdown from 'react-markdown'; import Button from '@/components/Button'; import Card from '@/components/Card'; import CardTitle from '@/components/CardTitle'; +import CodeEditor from '@/components/CodeEditor'; import DangerousRaw from '@/components/DangerousRaw'; import IconButton from '@/components/IconButton'; import Spacer from '@/components/Spacer'; @@ -65,7 +66,19 @@ const Step = ( {isExpanded && ( <> - {metadata} + { + const [, language] = /language-(\w+)/.exec(className ?? '') ?? []; + const content = String(children); + + return ; + }, + }} + > + {metadata} +