Skip to content

Commit cba975b

Browse files
authored
Merge pull request #35 from stack127labs/chore/audit-components-page
Components library, date and time pickers, and ECharts as the only chart system
2 parents 9a2243a + 2ff4e09 commit cba975b

75 files changed

Lines changed: 4308 additions & 1780 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { registryLayout } from "@/lib/registry-layout";
2+
3+
const registry = registryLayout("/components-ui/[section]");
4+
export const generateMetadata = registry.generateMetadata;
5+
export function generateStaticParams() { return []; }
6+
export const revalidate = false;
7+
export default registry.Layout;
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
import type { ComponentType } from "react";
2+
import { notFound } from "next/navigation";
3+
import { ActionsAndFormsExamples } from "../examples/actions-and-forms";
4+
import { CardsExamples } from "../examples/cards";
5+
import { ContentExamples } from "../examples/content";
6+
import { FeedbackAndDialogsExamples } from "../examples/feedback-and-dialogs";
7+
import { FileUploadsExamples } from "../examples/file-uploads";
8+
import { FiltersAndSortingExamples } from "../examples/filters-and-sorting";
9+
import { MediaAndArtExamples } from "../examples/media-and-art";
10+
import { NavigationExamples } from "../examples/navigation";
11+
import { NumbersAndSlidersExamples } from "../examples/numbers-and-sliders";
12+
import { PageLayoutExamples } from "../examples/page-layout";
13+
import { ResultsExamples } from "../examples/results";
14+
import { TablesExamples } from "../examples/tables";
15+
import { TextAndChoicesExamples } from "../examples/text-and-choices";
16+
import { GalleryPage } from "../gallery";
17+
import { gallerySection } from "../sections";
18+
19+
// Charts has its own route (../charts), so the interactive chart code never reaches the other sections.
20+
const examples: Record<string, ComponentType> = {
21+
"text-and-choices": TextAndChoicesExamples,
22+
"numbers-and-sliders": NumbersAndSlidersExamples,
23+
"actions-and-forms": ActionsAndFormsExamples,
24+
"file-uploads": FileUploadsExamples,
25+
"filters-and-sorting": FiltersAndSortingExamples,
26+
results: ResultsExamples,
27+
tables: TablesExamples,
28+
cards: CardsExamples,
29+
content: ContentExamples,
30+
"media-and-art": MediaAndArtExamples,
31+
"feedback-and-dialogs": FeedbackAndDialogsExamples,
32+
navigation: NavigationExamples,
33+
"page-layout": PageLayoutExamples,
34+
};
35+
36+
export default async function ComponentSectionPage({ params }: { params: Promise<{ section: string }> }) {
37+
if (process.env.NODE_ENV !== "development") notFound();
38+
const { section: slug } = await params;
39+
const section = gallerySection(slug);
40+
const Examples = examples[slug];
41+
if (!section || !Examples) notFound();
42+
43+
return <GalleryPage section={section}><Examples /></GalleryPage>;
44+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import { registryLayout } from "@/lib/registry-layout";
2+
3+
const registry = registryLayout("/components-ui/charts");
4+
export const generateMetadata = registry.generateMetadata;
5+
export const revalidate = false;
6+
export default registry.Layout;
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { notFound } from "next/navigation";
2+
import { ChartsExamples } from "../examples/charts";
3+
import { GalleryPage } from "../gallery";
4+
import { gallerySection } from "../sections";
5+
6+
/** The Charts section has its own route, so only this page loads the interactive chart code. */
7+
export default function ChartsSectionPage() {
8+
const section = gallerySection("charts");
9+
if (process.env.NODE_ENV !== "development" || !section) notFound();
10+
return <GalleryPage section={section}><ChartsExamples /></GalleryPage>;
11+
}
Lines changed: 263 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,263 @@
1+
/* Overview */
2+
3+
.sectionGrid {
4+
display: grid;
5+
gap: var(--space-6);
6+
grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
7+
list-style: none;
8+
margin: 0;
9+
padding: 0;
10+
}
11+
12+
.sectionLink {
13+
align-content: start;
14+
border: 1px solid var(--color-border);
15+
border-radius: var(--radius);
16+
color: var(--color-text);
17+
display: grid;
18+
gap: var(--space-3);
19+
height: 100%;
20+
padding: var(--space-7);
21+
text-decoration: none;
22+
}
23+
24+
.sectionLink:hover {
25+
background: var(--color-surface);
26+
border-color: var(--color-border-strong);
27+
}
28+
29+
.sectionLink:focus-visible {
30+
box-shadow: var(--focus-ring);
31+
outline: none;
32+
}
33+
34+
.sectionTitle {
35+
align-items: center;
36+
display: flex;
37+
font-family: var(--font-display);
38+
font-size: var(--text-h3);
39+
font-weight: var(--weight-bold);
40+
gap: var(--space-3);
41+
line-height: var(--line-heading);
42+
}
43+
44+
.sectionComponents {
45+
color: var(--color-text-muted);
46+
font-family: var(--font-mono);
47+
font-size: var(--text-small);
48+
overflow-wrap: anywhere;
49+
}
50+
51+
/* Section pages */
52+
53+
.examples {
54+
display: grid;
55+
min-width: 0;
56+
}
57+
58+
.example {
59+
display: grid;
60+
gap: var(--space-8);
61+
min-width: 0;
62+
padding: var(--space-12) 0;
63+
}
64+
65+
.example:first-child {
66+
padding-top: 0;
67+
}
68+
69+
.example + .example {
70+
border-top: 1px solid var(--color-border);
71+
}
72+
73+
.exampleHeading {
74+
display: grid;
75+
gap: var(--space-3);
76+
}
77+
78+
.exampleHeading h2,
79+
.exampleHeading p {
80+
margin: 0;
81+
}
82+
83+
.exampleHeading h2 {
84+
font-family: var(--font-display);
85+
font-size: var(--text-h2);
86+
letter-spacing: var(--tracking-display);
87+
line-height: var(--line-heading);
88+
}
89+
90+
.exampleHeading > p:not(.source) {
91+
max-width: var(--measure-prose);
92+
}
93+
94+
.source {
95+
align-items: center;
96+
color: var(--color-text-muted);
97+
display: flex;
98+
flex-wrap: wrap;
99+
font-family: var(--font-mono);
100+
font-size: var(--text-small);
101+
gap: var(--space-2) var(--space-4);
102+
}
103+
104+
.source code {
105+
color: var(--color-text);
106+
}
107+
108+
/* Example layouts */
109+
110+
.stack {
111+
display: grid;
112+
gap: var(--space-8);
113+
min-width: 0;
114+
}
115+
116+
.twoColumns,
117+
.cardGrid,
118+
.directoryFilters {
119+
display: grid;
120+
gap: var(--space-9);
121+
grid-template-columns: repeat(2, minmax(0, 1fr));
122+
min-width: 0;
123+
}
124+
125+
.cardGrid {
126+
align-items: stretch;
127+
}
128+
129+
.directoryFilters {
130+
gap: var(--space-8);
131+
max-width: 780px;
132+
}
133+
134+
.narrow {
135+
max-width: 420px;
136+
min-width: 0;
137+
}
138+
139+
.inlineChoices {
140+
align-items: center;
141+
display: flex;
142+
flex-wrap: wrap;
143+
gap: var(--space-6) var(--space-10);
144+
margin: 0;
145+
}
146+
147+
.frame {
148+
border: 1px solid var(--color-border);
149+
border-radius: var(--radius);
150+
min-width: 0;
151+
overflow: hidden;
152+
padding: var(--space-8);
153+
position: relative;
154+
}
155+
156+
.cardLogo {
157+
border: 1px solid var(--color-border-strong);
158+
border-radius: var(--radius);
159+
color: var(--color-text);
160+
display: grid;
161+
font-family: var(--font-display);
162+
font-weight: var(--weight-bold);
163+
height: 48px;
164+
place-items: center;
165+
width: 48px;
166+
}
167+
168+
.markerExample {
169+
max-width: 320px;
170+
}
171+
172+
.doodleRow {
173+
align-items: center;
174+
display: flex;
175+
flex-wrap: wrap;
176+
gap: var(--space-10);
177+
}
178+
179+
.dialogHeading {
180+
align-items: center;
181+
display: flex;
182+
justify-content: space-between;
183+
}
184+
185+
.sidebarExamples {
186+
display: grid;
187+
gap: var(--space-9);
188+
grid-template-columns: repeat(3, minmax(0, 260px));
189+
}
190+
191+
.iconGrid {
192+
display: grid;
193+
gap: var(--space-5);
194+
grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
195+
list-style: none;
196+
margin: 0;
197+
padding: 0;
198+
}
199+
200+
.iconGrid li {
201+
align-items: center;
202+
display: flex;
203+
gap: var(--space-3);
204+
}
205+
206+
.iconGrid code {
207+
color: var(--color-text-muted);
208+
font-size: var(--text-small);
209+
}
210+
211+
.brandExample {
212+
display: block;
213+
height: 32px;
214+
width: 150px;
215+
}
216+
217+
.layoutLinks {
218+
display: grid;
219+
gap: var(--space-4);
220+
list-style: none;
221+
margin: 0;
222+
padding: 0;
223+
}
224+
225+
.layoutLinks li {
226+
display: flex;
227+
flex-wrap: wrap;
228+
gap: var(--space-2) var(--space-5);
229+
}
230+
231+
.layoutLinks span {
232+
color: var(--color-text-muted);
233+
}
234+
235+
@media (max-width: 900px) {
236+
.sidebarExamples {
237+
grid-template-columns: minmax(0, 320px);
238+
}
239+
}
240+
241+
@media (max-width: 700px) {
242+
.twoColumns,
243+
.cardGrid,
244+
.directoryFilters {
245+
grid-template-columns: 1fr;
246+
}
247+
248+
.inlineChoices {
249+
align-items: flex-start;
250+
flex-direction: column;
251+
}
252+
253+
.frame {
254+
padding: var(--space-5);
255+
}
256+
}
257+
258+
.chartWeight {
259+
color: var(--color-text-muted);
260+
font-family: var(--font-mono);
261+
font-size: var(--text-small);
262+
margin: 0;
263+
}

0 commit comments

Comments
 (0)