astryx-dracula 0.5.0 → 0.6.2
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/BRAND.md +3 -3
- package/README.md +7 -4
- package/USAGE.md +49 -49
- package/astryx-dracula.d.ts +2 -2
- package/astryx-dracula.js +25 -9
- package/astryx-dracula.variants.d.ts +2 -2
- package/astryx.integration.mjs +1 -1
- package/icons.mjs +21 -17
- package/icons.tsx +69 -62
- package/package.json +125 -120
- package/shared/auth-chrome-config.ts +6 -6
- package/shared/auth-chrome.tsx +143 -144
- package/shared/auth-copy.ts +14 -14
- package/shared/chaptered-doc-config.ts +48 -51
- package/shared/chaptered-doc.tsx +267 -289
- package/shared/chart-hues.ts +25 -10
- package/shared/chart-labels.tsx +31 -30
- package/shared/chart-legend.tsx +55 -56
- package/shared/chart-panel-style.ts +3 -3
- package/shared/data-bar.tsx +97 -102
- package/shared/format-money.ts +1 -1
- package/shared/gallery-image.ts +6 -6
- package/shared/login-demo.ts +1 -1
- package/shared/metric-card.tsx +101 -105
- package/shared/metric-delta.tsx +28 -27
- package/shared/order-desk.tsx +205 -216
- package/shared/revenue-chart.tsx +145 -165
- package/shared/scene-castle.tsx +206 -291
- package/shared/scene-frame.tsx +33 -32
- package/shared/scene-hues.ts +17 -17
- package/shared/scene-tile.tsx +88 -92
- package/shared/settings-data.ts +119 -125
- package/shared/settings-rows.tsx +122 -159
- package/shared/sparkline.tsx +75 -88
- package/shared/sso-icons.tsx +10 -22
- package/shared/stars.tsx +16 -25
- package/templates/ai-chat-landing.template.mjs +5 -4
- package/templates/ai-chat-landing.tsx +473 -460
- package/templates/ai-chat.template.mjs +5 -4
- package/templates/ai-chat.tsx +543 -612
- package/templates/blank.template.mjs +5 -4
- package/templates/blank.tsx +18 -14
- package/templates/centered-hero.template.mjs +5 -4
- package/templates/centered-hero.tsx +55 -68
- package/templates/classic-gallery.template.mjs +5 -4
- package/templates/classic-gallery.tsx +97 -104
- package/templates/contact-form.template.mjs +5 -4
- package/templates/contact-form.tsx +247 -282
- package/templates/dashboard-portfolio.template.mjs +5 -4
- package/templates/dashboard-portfolio.tsx +717 -548
- package/templates/dashboard.template.mjs +5 -4
- package/templates/dashboard.tsx +596 -567
- package/templates/detail-page.template.mjs +5 -4
- package/templates/detail-page.tsx +546 -603
- package/templates/documentation-design.template.mjs +5 -4
- package/templates/documentation-design.tsx +231 -243
- package/templates/documentation-technical.template.mjs +5 -4
- package/templates/documentation-technical.tsx +236 -239
- package/templates/documentation.template.mjs +5 -4
- package/templates/documentation.tsx +267 -279
- package/templates/editor.template.mjs +5 -4
- package/templates/editor.tsx +844 -877
- package/templates/file-explorer.template.mjs +5 -4
- package/templates/file-explorer.tsx +566 -590
- package/templates/form-two-column.template.mjs +5 -4
- package/templates/form-two-column.tsx +195 -210
- package/templates/gallery-hero.template.mjs +5 -4
- package/templates/gallery-hero.tsx +93 -114
- package/templates/ide.template.mjs +5 -4
- package/templates/ide.tsx +407 -453
- package/templates/incident-console.template.mjs +5 -4
- package/templates/incident-console.tsx +593 -575
- package/templates/kanban-board.template.mjs +5 -4
- package/templates/kanban-board.tsx +665 -683
- package/templates/library.template.mjs +5 -4
- package/templates/library.tsx +409 -430
- package/templates/login-card.template.mjs +5 -4
- package/templates/login-card.tsx +63 -72
- package/templates/login-split.template.mjs +5 -4
- package/templates/login-split.tsx +192 -193
- package/templates/login-sso.template.mjs +5 -4
- package/templates/login-sso.tsx +257 -258
- package/templates/login.template.mjs +5 -4
- package/templates/login.tsx +53 -49
- package/templates/messaging-shell.template.mjs +5 -4
- package/templates/messaging-shell.tsx +556 -574
- package/templates/mixed-gallery.template.mjs +5 -4
- package/templates/mixed-gallery.tsx +60 -58
- package/templates/payment-form.template.mjs +5 -4
- package/templates/payment-form.tsx +882 -991
- package/templates/product-detail.template.mjs +5 -4
- package/templates/product-detail.tsx +261 -272
- package/templates/product-gallery.template.mjs +5 -4
- package/templates/product-gallery.tsx +126 -137
- package/templates/product-tour.template.mjs +5 -4
- package/templates/product-tour.tsx +741 -773
- package/templates/settings-dialog.template.mjs +5 -4
- package/templates/settings-dialog.tsx +688 -717
- package/templates/settings-sidebar.template.mjs +5 -4
- package/templates/settings-sidebar.tsx +762 -807
- package/templates/settings.template.mjs +5 -4
- package/templates/settings.tsx +289 -304
- package/templates/shell-nav.template.mjs +5 -4
- package/templates/shell-nav.tsx +212 -219
- package/templates/shell-side-nav.template.mjs +5 -4
- package/templates/shell-side-nav.tsx +135 -157
- package/templates/shell-top-nav.template.mjs +5 -4
- package/templates/shell-top-nav.tsx +182 -203
- package/templates/side-gallery.template.mjs +5 -4
- package/templates/side-gallery.tsx +85 -90
- package/templates/table-grouped.template.mjs +5 -4
- package/templates/table-grouped.tsx +1000 -1053
- package/templates/table-page-chart.template.mjs +5 -4
- package/templates/table-page-chart.tsx +400 -398
- package/templates/table-page-heatmap-status.template.mjs +5 -4
- package/templates/table-page-heatmap-status.tsx +483 -512
- package/templates/table-page-shoe-store-heatmap.template.mjs +5 -4
- package/templates/table-page-shoe-store-heatmap.tsx +748 -746
- package/templates/table-page.template.mjs +5 -4
- package/templates/table-page.tsx +396 -405
- package/templates/table.template.mjs +5 -4
- package/templates/table.tsx +92 -93
- package/templates/tech-report.template.mjs +5 -4
- package/templates/tech-report.tsx +1316 -1304
- package/templates/theme-showcase.template.mjs +5 -4
- package/templates/theme-showcase.tsx +871 -951
- package/theme.css +35 -77
- package/theme.css.d.ts +9 -0
- package/tokens.css +373 -380
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export default {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
type: "page",
|
|
3
|
+
name: "Design Documentation",
|
|
4
|
+
description: "Live preview, usage guide, and code examples",
|
|
5
|
+
keywords: ["documentation", "docs", "design system", "reference", "guide", "spec"],
|
|
6
|
+
category: "docs",
|
|
6
7
|
};
|
|
@@ -1,45 +1,42 @@
|
|
|
1
1
|
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
-
// XLE (canonical structure
|
|
3
|
-
//
|
|
2
|
+
// XLE (canonical structure of the tree below; the CLI had no XLE validator
|
|
3
|
+
// after `astryx layout` was removed in 0.7.0, so this is a reading aid and a
|
|
4
|
+
// human drift check — update it with the file, never alone):
|
|
5
|
+
// L[h=auto mw=960] > (LC[p=8 !scroll] > V[g=8] > (V[g=2] > Hd"Button"[level=1 t=display-2] + Tx"March 30, 2026"[t=supporting] + SE{Selector}"On this page") + (C.muted[p=0] > Ctr[h=360]) + (V[g=4] > Hd"Usage"[level=2] + Tx"Usage"[t=body] + Hd"Best practices"[level=3] + T[hover density=spacious]) + D + (V[g=4] > Hd"Examples"[level=2] + Tx"Explore"[t=body]) + (V[g=8] > (C[p=0] > (S.transparent[p=3] > Tx"Semantics"[t=body]) + Ctr[h=280] + (S.muted[p=3 dv=[top]] > V[g=3] > (TL[size=sm] > (Tab"Description"! + Tab"Code")) + Tx"We have four"[t=body])) + (C[p=0] > (S.transparent[p=3] > Tx"Default button with badge"[t=body]) + Ctr[h=280] + (S.muted[p=3 dv=[top]] > V[g=3] > (TL[size=sm] > (Tab"Description"! + Tab"Code")) + Tx"Buttons can include"[t=body])))) + (LP[!scroll] > Outline)
|
|
4
6
|
|
|
5
7
|
/**
|
|
6
8
|
* Documentation detail — one component, its usage, its guidance and its live examples. (Frame/responsive/container: see XLE header above.)
|
|
7
9
|
*/
|
|
8
10
|
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
} from
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {Selector} from
|
|
21
|
-
import {HStack, VStack} from
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
28
|
-
import {Center} from '@astryxdesign/core/Center';
|
|
29
|
-
import {Outline, type OutlineItem} from '@astryxdesign/core/Outline';
|
|
30
|
-
import {Plus} from 'lucide-react';
|
|
31
|
-
import {outlinePanel} from 'astryx-dracula/shared/chaptered-doc-config';
|
|
32
|
-
|
|
11
|
+
import { Badge } from "@astryxdesign/core/Badge";
|
|
12
|
+
import { Button } from "@astryxdesign/core/Button";
|
|
13
|
+
import { Card } from "@astryxdesign/core/Card";
|
|
14
|
+
import { Center } from "@astryxdesign/core/Center";
|
|
15
|
+
import { CodeBlock } from "@astryxdesign/core/CodeBlock";
|
|
16
|
+
import { Divider } from "@astryxdesign/core/Divider";
|
|
17
|
+
import { useMediaQuery } from "@astryxdesign/core/hooks";
|
|
18
|
+
import { Icon } from "@astryxdesign/core/Icon";
|
|
19
|
+
import { Layout, LayoutContent, LayoutPanel } from "@astryxdesign/core/Layout";
|
|
20
|
+
import { Outline, type OutlineItem } from "@astryxdesign/core/Outline";
|
|
21
|
+
import { Section } from "@astryxdesign/core/Section";
|
|
22
|
+
import { Selector } from "@astryxdesign/core/Selector";
|
|
23
|
+
import { HStack, VStack } from "@astryxdesign/core/Stack";
|
|
24
|
+
import { Tab, TabList } from "@astryxdesign/core/TabList";
|
|
25
|
+
import { pixel, proportional, Table } from "@astryxdesign/core/Table";
|
|
26
|
+
import { Heading, Text } from "@astryxdesign/core/Text";
|
|
27
|
+
import { outlinePanel } from "astryx-dracula/shared/chaptered-doc-config";
|
|
28
|
+
import { Plus } from "lucide-react";
|
|
29
|
+
import { type ReactNode, useCallback, useState } from "react";
|
|
33
30
|
|
|
34
31
|
const COMPONENT_OUTLINE_ITEMS: OutlineItem[] = [
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
32
|
+
{ id: "usage", label: "Usage", level: 2 },
|
|
33
|
+
{ id: "best-practices", label: "Best practices", level: 3 },
|
|
34
|
+
{ id: "examples", label: "Examples", level: 2 },
|
|
38
35
|
];
|
|
39
36
|
|
|
40
|
-
const COMPONENT_OUTLINE_OPTIONS = COMPONENT_OUTLINE_ITEMS.map(item => ({
|
|
41
|
-
|
|
42
|
-
|
|
37
|
+
const COMPONENT_OUTLINE_OPTIONS = COMPONENT_OUTLINE_ITEMS.map((item) => ({
|
|
38
|
+
value: item.id,
|
|
39
|
+
label: item.label,
|
|
43
40
|
}));
|
|
44
41
|
|
|
45
42
|
// ---------------------------------------------------------------------------
|
|
@@ -51,51 +48,50 @@ const COMPONENT_OUTLINE_OPTIONS = COMPONENT_OUTLINE_ITEMS.map(item => ({
|
|
|
51
48
|
// the name/docs/previews below index it directly instead of threading a
|
|
52
49
|
// parameter that can never vary.
|
|
53
50
|
// The only caller ever passed 'button': the component name is a literal, not a lookup.
|
|
54
|
-
const ACTIVE_COMPONENT_NAME =
|
|
51
|
+
const ACTIVE_COMPONENT_NAME = "Button";
|
|
55
52
|
|
|
56
53
|
const COMPONENT_DOCS: Record<
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
54
|
+
string,
|
|
55
|
+
{
|
|
56
|
+
usage: string;
|
|
57
|
+
bestPractices: { type: "do" | "dont"; text: string }[];
|
|
58
|
+
examples: { title: string; description: string; code: string }[];
|
|
59
|
+
}
|
|
63
60
|
> = {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
},
|
|
61
|
+
button: {
|
|
62
|
+
usage:
|
|
63
|
+
"Buttons provide visual cues for actions and events. These fundamental components allow users to commit actions and navigate a page flow. Use a Button when a user needs to submit a form, start a new task or action, or trigger a new UI element to appear on the page.",
|
|
64
|
+
bestPractices: [
|
|
65
|
+
{
|
|
66
|
+
type: "do",
|
|
67
|
+
text: "Convey clear action hierarchy: Each surface should only have 1 primary button. A majority of buttons should be in default or flat style.",
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
type: "do",
|
|
71
|
+
text: "Promote clarity: Consider labels alongside icons where appropriate.",
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
type: "dont",
|
|
75
|
+
text: "Overuse primary or special buttons: Overusing colored buttons will result in a page with less intentionality, create visual confusion and a lack of page hierarchy.",
|
|
76
|
+
},
|
|
77
|
+
],
|
|
78
|
+
examples: [
|
|
79
|
+
{
|
|
80
|
+
title: "Semantics",
|
|
81
|
+
description:
|
|
82
|
+
"We have four semantic buttons types: flat, default, primary, and destructive. Flat buttons are used to limit visual prominence, whereas primary emphasizes a single action. Use destructive for deletions that trigger dialog confirmations.",
|
|
83
|
+
code: `<Button label="Flat" variant="ghost" />\n<Button label="Default" variant="secondary" />\n<Button label="Primary" variant="primary" />\n<Button label="Destructive" variant="destructive" />`,
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
title: "Default button with badge",
|
|
87
|
+
description: "Buttons can include a badge to highlight new or updated actions.",
|
|
88
|
+
code: `<Button\n label="Button"\n variant="secondary"\n/>`,
|
|
89
|
+
},
|
|
90
|
+
],
|
|
91
|
+
},
|
|
96
92
|
};
|
|
97
93
|
|
|
98
|
-
const ACTIVE_DOCS = COMPONENT_DOCS
|
|
94
|
+
const ACTIVE_DOCS = COMPONENT_DOCS.button;
|
|
99
95
|
|
|
100
96
|
// One preview node per example in ACTIVE_DOCS.examples, index-aligned. The
|
|
101
97
|
// old EXAMPLE_PREVIEWS record carried only this key, so the record wrapper
|
|
@@ -103,22 +99,22 @@ const ACTIVE_DOCS = COMPONENT_DOCS['button'];
|
|
|
103
99
|
// tooltip entries in the old COMPONENT_PREVIEWS map were reachable only
|
|
104
100
|
// through nav keys this page never renders, so they are gone.
|
|
105
101
|
const EXAMPLE_PREVIEW_NODES: ReactNode[] = [
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
102
|
+
<HStack key="semantics" gap={3} vAlign="center" wrap="wrap">
|
|
103
|
+
<Button label="Flat" variant="ghost" />
|
|
104
|
+
<Button label="Default" variant="secondary" />
|
|
105
|
+
<Button label="Primary" variant="primary" />
|
|
106
|
+
<Button label="Destructive" variant="destructive" />
|
|
107
|
+
</HStack>,
|
|
108
|
+
<Button key="badge" label="Button" variant="secondary" />,
|
|
113
109
|
];
|
|
114
110
|
|
|
115
111
|
const HERO_PREVIEW = (
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
112
|
+
<Button
|
|
113
|
+
label="Button"
|
|
114
|
+
variant="secondary"
|
|
115
|
+
icon={<Icon icon={Plus} />}
|
|
116
|
+
endContent={<Badge label="New" variant="cyan" />}
|
|
117
|
+
/>
|
|
122
118
|
);
|
|
123
119
|
|
|
124
120
|
// ---------------------------------------------------------------------------
|
|
@@ -126,170 +122,162 @@ const HERO_PREVIEW = (
|
|
|
126
122
|
// ---------------------------------------------------------------------------
|
|
127
123
|
|
|
128
124
|
function ComponentDetailView() {
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
);
|
|
133
|
-
const isMobile = useMediaQuery('(max-width: 768px)');
|
|
125
|
+
const [exampleTabs, setExampleTabs] = useState<Record<string, string>>({});
|
|
126
|
+
const [activeId, setActiveId] = useState<string | undefined>(COMPONENT_OUTLINE_ITEMS[0]?.id);
|
|
127
|
+
const isMobile = useMediaQuery("(max-width: 768px)");
|
|
134
128
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
129
|
+
const scrollToId = useCallback((id: string) => {
|
|
130
|
+
setActiveId(id);
|
|
131
|
+
const target = document.getElementById(id);
|
|
132
|
+
if (target != null) {
|
|
133
|
+
target.scrollIntoView({ behavior: "smooth", block: "start" });
|
|
134
|
+
window.history.pushState(null, "", `#${id}`);
|
|
135
|
+
}
|
|
136
|
+
}, []);
|
|
143
137
|
|
|
144
|
-
|
|
145
|
-
|
|
138
|
+
const docs = ACTIVE_DOCS;
|
|
139
|
+
const previews = EXAMPLE_PREVIEW_NODES;
|
|
146
140
|
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
141
|
+
return (
|
|
142
|
+
<Layout
|
|
143
|
+
height="auto"
|
|
144
|
+
contentWidth={960}
|
|
145
|
+
end={
|
|
146
|
+
isMobile ? undefined : (
|
|
147
|
+
<LayoutPanel
|
|
148
|
+
isScrollable={false}
|
|
149
|
+
label="On this page"
|
|
150
|
+
role="complementary"
|
|
151
|
+
style={outlinePanel}
|
|
152
|
+
>
|
|
153
|
+
<Outline items={COMPONENT_OUTLINE_ITEMS} onActiveIdChange={setActiveId} />
|
|
154
|
+
</LayoutPanel>
|
|
155
|
+
)
|
|
156
|
+
}
|
|
157
|
+
content={
|
|
158
|
+
<LayoutContent isScrollable={false} padding={8}>
|
|
159
|
+
<VStack gap={8}>
|
|
160
|
+
<VStack gap={2}>
|
|
161
|
+
<Heading level={1} type="display-2">
|
|
162
|
+
{ACTIVE_COMPONENT_NAME}
|
|
163
|
+
</Heading>
|
|
164
|
+
<Text type="supporting" color="secondary" hasTabularNumbers>
|
|
165
|
+
March 30, 2026 · Updated 5:40 p.m. PST
|
|
166
|
+
</Text>
|
|
167
|
+
{isMobile && (
|
|
168
|
+
<Selector
|
|
169
|
+
label="On this page"
|
|
170
|
+
isLabelHidden
|
|
171
|
+
options={COMPONENT_OUTLINE_OPTIONS}
|
|
172
|
+
value={activeId}
|
|
173
|
+
onChange={scrollToId}
|
|
174
|
+
width="100%"
|
|
175
|
+
/>
|
|
176
|
+
)}
|
|
177
|
+
</VStack>
|
|
184
178
|
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
</Center>
|
|
189
|
-
</Card>
|
|
179
|
+
<Card variant="muted" padding={0}>
|
|
180
|
+
<Center height={360}>{HERO_PREVIEW}</Center>
|
|
181
|
+
</Card>
|
|
190
182
|
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
183
|
+
<VStack gap={4}>
|
|
184
|
+
<Heading id="usage" level={2}>
|
|
185
|
+
Usage
|
|
186
|
+
</Heading>
|
|
187
|
+
<Text type="body">{docs.usage}</Text>
|
|
188
|
+
<Heading id="best-practices" level={3}>
|
|
189
|
+
Best practices
|
|
190
|
+
</Heading>
|
|
191
|
+
<Table
|
|
192
|
+
data={docs.bestPractices as Record<string, unknown>[]}
|
|
193
|
+
dividers="none"
|
|
194
|
+
hasHover
|
|
195
|
+
columns={[
|
|
196
|
+
{
|
|
197
|
+
key: "type",
|
|
198
|
+
header: "Guidance",
|
|
199
|
+
width: pixel(125),
|
|
200
|
+
renderCell: (item: Record<string, unknown>) => (
|
|
201
|
+
<Badge
|
|
202
|
+
label={item.type === "do" ? "Do" : "Don't"}
|
|
203
|
+
variant={item.type === "do" ? "green" : "red"}
|
|
204
|
+
/>
|
|
205
|
+
),
|
|
206
|
+
},
|
|
207
|
+
{
|
|
208
|
+
key: "text",
|
|
209
|
+
header: "Practices",
|
|
210
|
+
width: proportional(1),
|
|
211
|
+
renderCell: (item: Record<string, unknown>) => (
|
|
212
|
+
<Text type="body" textWrap="wrap">
|
|
213
|
+
{item.text as string}
|
|
214
|
+
</Text>
|
|
215
|
+
),
|
|
216
|
+
},
|
|
217
|
+
]}
|
|
218
|
+
density="spacious"
|
|
219
|
+
/>
|
|
220
|
+
</VStack>
|
|
229
221
|
|
|
230
|
-
|
|
222
|
+
<Divider />
|
|
231
223
|
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
</LayoutContent>
|
|
290
|
-
}
|
|
291
|
-
/>
|
|
292
|
-
);
|
|
224
|
+
<VStack gap={4}>
|
|
225
|
+
<Heading id="examples" level={2}>
|
|
226
|
+
Examples
|
|
227
|
+
</Heading>
|
|
228
|
+
<Text type="body">
|
|
229
|
+
Explore common configurations, variations, and states for this component.
|
|
230
|
+
</Text>
|
|
231
|
+
</VStack>
|
|
232
|
+
<VStack gap={8}>
|
|
233
|
+
{docs.examples.map((example, i) => {
|
|
234
|
+
const tabKey = `example-${i}`;
|
|
235
|
+
const activeTab = exampleTabs[tabKey] ?? "description";
|
|
236
|
+
return (
|
|
237
|
+
<Card key={example.title} padding={0}>
|
|
238
|
+
<Section padding={3} variant="transparent">
|
|
239
|
+
<Text type="body" weight="semibold">
|
|
240
|
+
{example.title}
|
|
241
|
+
</Text>
|
|
242
|
+
</Section>
|
|
243
|
+
<Center height={280}>
|
|
244
|
+
{previews[i] ?? (
|
|
245
|
+
<Text type="supporting" color="secondary">
|
|
246
|
+
Quiet in the crypt — no preview haunts this shelf yet.
|
|
247
|
+
</Text>
|
|
248
|
+
)}
|
|
249
|
+
</Center>
|
|
250
|
+
<Section variant="muted" padding={3} dividers={["top"]}>
|
|
251
|
+
<VStack gap={3}>
|
|
252
|
+
<TabList
|
|
253
|
+
value={activeTab}
|
|
254
|
+
onChange={(value) =>
|
|
255
|
+
setExampleTabs((prev) => ({
|
|
256
|
+
...prev,
|
|
257
|
+
[tabKey]: value,
|
|
258
|
+
}))
|
|
259
|
+
}
|
|
260
|
+
size="sm"
|
|
261
|
+
>
|
|
262
|
+
<Tab value="description" label="Description" />
|
|
263
|
+
<Tab value="code" label="Code" />
|
|
264
|
+
</TabList>
|
|
265
|
+
{activeTab === "description" ? (
|
|
266
|
+
<Text type="body">{example.description}</Text>
|
|
267
|
+
) : (
|
|
268
|
+
<CodeBlock code={example.code} language="tsx" width="100%" />
|
|
269
|
+
)}
|
|
270
|
+
</VStack>
|
|
271
|
+
</Section>
|
|
272
|
+
</Card>
|
|
273
|
+
);
|
|
274
|
+
})}
|
|
275
|
+
</VStack>
|
|
276
|
+
</VStack>
|
|
277
|
+
</LayoutContent>
|
|
278
|
+
}
|
|
279
|
+
/>
|
|
280
|
+
);
|
|
293
281
|
}
|
|
294
282
|
|
|
295
283
|
// ---------------------------------------------------------------------------
|
|
@@ -297,5 +285,5 @@ function ComponentDetailView() {
|
|
|
297
285
|
// ---------------------------------------------------------------------------
|
|
298
286
|
|
|
299
287
|
export default function DocumentationDesign() {
|
|
300
|
-
|
|
288
|
+
return <ComponentDetailView />;
|
|
301
289
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export default {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
type: "page",
|
|
3
|
+
name: "Technical Documentation",
|
|
4
|
+
description: "Install steps, theming setup, and next steps",
|
|
5
|
+
keywords: ["documentation", "technical", "api reference", "spec", "manual", "reference"],
|
|
6
|
+
category: "docs",
|
|
6
7
|
};
|