({ css }: ThemeCodeProps)
| 11 | } |
| 12 | |
| 13 | export const ThemeCode = ({ css }: ThemeCodeProps) => { |
| 14 | const prettyCode = React.useMemo(() => { |
| 15 | return highlighter.codeToHtml(css, { |
| 16 | lang: "css", |
| 17 | themes: { |
| 18 | dark: "github-dark-default", |
| 19 | light: "github-light-default", |
| 20 | }, |
| 21 | transformers: [ |
| 22 | { |
| 23 | pre(node) { |
| 24 | node.properties.style = "tab-size: 2" |
| 25 | }, |
| 26 | code(node) { |
| 27 | node.properties.style = "tab-size: 2" |
| 28 | }, |
| 29 | }, |
| 30 | ], |
| 31 | }) |
| 32 | }, [css]) |
| 33 | |
| 34 | return ( |
| 35 | <div className="w-full overflow-hidden rounded-md border"> |
| 36 | <CodeBar |
| 37 | label="globals.css" |
| 38 | className="border-t-0" |
| 39 | content={css} |
| 40 | type="other" |
| 41 | /> |
| 42 | |
| 43 | <div |
| 44 | className="max-h-[600px] overflow-auto p-4 text-sm" |
| 45 | dangerouslySetInnerHTML={{ __html: prettyCode }} |
| 46 | /> |
| 47 | </div> |
| 48 | ) |
| 49 | } |
nothing calls this directly
no outgoing calls
no test coverage detected