({ children }: Props)
| 14 | } |
| 15 | |
| 16 | export default function FileTreeDiagram({ children }: Props) { |
| 17 | const root = children() |
| 18 | |
| 19 | const output = diagram(root, { |
| 20 | getChildren: (node) => { |
| 21 | const normalized = normalizeNode(node) |
| 22 | return normalized.children ?? [] |
| 23 | }, |
| 24 | getLabel: (node) => { |
| 25 | const normalized = normalizeNode(node) |
| 26 | // return `${'children' in normalized ? '๐' : '๐'} ${normalized.name}` |
| 27 | return normalized.name |
| 28 | }, |
| 29 | type: 'directory', |
| 30 | flattenSingleChildNodes: false, |
| 31 | }) |
| 32 | |
| 33 | return ( |
| 34 | <Pre |
| 35 | style={{ |
| 36 | border: '1px solid rgba(0,0,0,0.05)', |
| 37 | padding: '16px 20px', |
| 38 | }} |
| 39 | > |
| 40 | <Code |
| 41 | style={{ |
| 42 | lineHeight: '1.3', |
| 43 | fontSize: '14px', |
| 44 | }} |
| 45 | > |
| 46 | {output} |
| 47 | </Code> |
| 48 | </Pre> |
| 49 | ) |
| 50 | } |
nothing calls this directly
no test coverage detected