seemore 1.8.5 → 1.8.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -180,7 +180,21 @@ export function Overview() {
|
|
|
180
180
|
/** Pages render as card grids; a folder opens a titled section holding its own cards. */
|
|
181
181
|
type Segment = { pages: PageTree.Item[] } | { folder: PageTree.Folder };
|
|
182
182
|
|
|
183
|
-
|
|
183
|
+
/** h2 at the top level, one step smaller per nesting level, capped at h6. */
|
|
184
|
+
const SECTION_HEADING_TAGS = ['h2', 'h3', 'h4', 'h5', 'h6'] as const;
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* A folder's own children render inside its `<section>`, so depth already exists in the DOM —
|
|
188
|
+
* each level just needs to look indented. Capped so a very deep tree doesn't march off the page.
|
|
189
|
+
*/
|
|
190
|
+
const SECTION_INDENT_CLASSES = [
|
|
191
|
+
'',
|
|
192
|
+
'ms-4 ps-4 border-s border-fd-border',
|
|
193
|
+
'ms-6 ps-4 border-s border-fd-border',
|
|
194
|
+
'ms-8 ps-4 border-s border-fd-border',
|
|
195
|
+
];
|
|
196
|
+
|
|
197
|
+
function OverviewSections({ nodes, depth = 0 }: { nodes: PageTree.Node[]; depth?: number }) {
|
|
184
198
|
const segments: Segment[] = [];
|
|
185
199
|
for (const node of nodes) {
|
|
186
200
|
if (node.type === 'page') {
|
|
@@ -192,14 +206,17 @@ function OverviewSections({ nodes }: { nodes: PageTree.Node[] }) {
|
|
|
192
206
|
}
|
|
193
207
|
}
|
|
194
208
|
|
|
209
|
+
const Heading = SECTION_HEADING_TAGS[Math.min(depth, SECTION_HEADING_TAGS.length - 1)] ?? 'h6';
|
|
210
|
+
const indentClass = SECTION_INDENT_CLASSES[Math.min(depth, SECTION_INDENT_CLASSES.length - 1)];
|
|
211
|
+
|
|
195
212
|
return (
|
|
196
213
|
<>
|
|
197
214
|
{segments.map((segment, index) =>
|
|
198
215
|
'pages' in segment ? (
|
|
199
216
|
<OverviewGrid key={index} pages={segment.pages} />
|
|
200
217
|
) : (
|
|
201
|
-
<section key={index} className=
|
|
202
|
-
<
|
|
218
|
+
<section key={index} className={`seemore-overview-section ${indentClass}`}>
|
|
219
|
+
<Heading className="seemore-overview-section-title">{segment.folder.name}</Heading>
|
|
203
220
|
{typeof segment.folder.description === 'string' && segment.folder.description !== '' ? (
|
|
204
221
|
<p className="seemore-overview-section-description">{segment.folder.description}</p>
|
|
205
222
|
) : undefined}
|
|
@@ -210,6 +227,7 @@ function OverviewSections({ nodes }: { nodes: PageTree.Node[] }) {
|
|
|
210
227
|
? segment.folder.children
|
|
211
228
|
: [segment.folder.index, ...segment.folder.children]
|
|
212
229
|
}
|
|
230
|
+
depth={depth + 1}
|
|
213
231
|
/>
|
|
214
232
|
</section>
|
|
215
233
|
),
|