import { Box } from '@luke-ui/react/box'; import { Button } from '@luke-ui/react/button'; import { cx } from '@luke-ui/react/utils'; import { useState } from 'react'; import { CodeBlock } from './code-block/code-block.js'; import * as styles from './example-code-preview.css.js'; export function ExampleCodePreview({ html, source, title, }: { html: string; source: string; title: string; }) { const [isExpanded, setIsExpanded] = useState(false); // Lines never wrap, so the line count says whether the preview clips. const canExpand = source.split('\n').length > styles.collapsedLineCount; return ( {/* Shiki escapes the source before the Vite plugin generates this HTML. */} {canExpand ? ( ) : null} ); }