Skip to content

Commit f8ad635

Browse files
cixzhangjiunshinn
andcommitted
feat(lab): DialogHeroHeader showcase, and astryx discover lists it
Carries jiunshinn's showcase block and doc, the official package index entries, and the CLI changeset from #5105. Co-authored-by: jiunshinn <jiun.dev@gmail.com>
1 parent 9a05f56 commit f8ad635

5 files changed

Lines changed: 134 additions & 0 deletions

File tree

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'@astryxdesign/cli': patch
3+
---
4+
5+
[feat] `astryx discover` lists the Lab DialogHeroHeader component and its DialogHeroHeaderShowcase template from `@astryxdesign/lab`. (#4182)
6+
@jiunshinn

‎internal/shadcn-registry/routes.lock.json‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4541,6 +4541,11 @@
45414541
"path": "showcases/dialog-header/default",
45424542
"aliases": []
45434543
},
4544+
{
4545+
"name": "showcase-dialog-hero-header-default",
4546+
"path": "showcases/dialog-hero-header/default",
4547+
"aliases": []
4548+
},
45444549
{
45454550
"name": "showcase-dialog-default",
45464551
"path": "showcases/dialog/default",

‎packages/cli/assets/discover/official-packages.json‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,10 @@
128128
"kind": "component",
129129
"name": "CommentThread"
130130
},
131+
{
132+
"kind": "component",
133+
"name": "DialogHeroHeader"
134+
},
131135
{
132136
"kind": "component",
133137
"name": "DiffViewer"
@@ -232,6 +236,10 @@
232236
"kind": "template",
233237
"name": "CommentThreadShowcase"
234238
},
239+
{
240+
"kind": "template",
241+
"name": "DialogHeroHeaderShowcase"
242+
},
235243
{
236244
"kind": "template",
237245
"name": "DiffViewerShowcase"
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// Copyright (c) Meta Platforms, Inc. and affiliates.
2+
3+
/**
4+
* @file DialogHeroHeaderShowcase.doc.mjs
5+
* @input DialogHeroHeaderShowcase.tsx
6+
* @output Showcase ownership and preview metadata
7+
* @position Lab integration template registration for DialogHeroHeader
8+
*/
9+
10+
/** @type {import('@astryxdesign/cli/authoring').TemplateDoc} */
11+
export default {
12+
type: 'block',
13+
name: 'DialogHeroHeader',
14+
displayName: 'Dialog Hero Header',
15+
description:
16+
'An onboarding dialog with full-bleed artwork and an overlaid close button.',
17+
exampleFor: 'DialogHeroHeader',
18+
isShowcase: true,
19+
aspectRatio: 4 / 3,
20+
componentsUsed: [
21+
'DialogHeroHeader',
22+
'Dialog',
23+
'Layout',
24+
'LayoutContent',
25+
'LayoutFooter',
26+
'Button',
27+
'Text',
28+
],
29+
};
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
// Copyright (c) Meta Platforms, Inc. and affiliates.
2+
3+
'use client';
4+
5+
/**
6+
* @file DialogHeroHeaderShowcase.tsx
7+
* @input DialogHeroHeader composed with Dialog and Layout
8+
* @output A dismissible onboarding preview with full-bleed decorative media
9+
* @position Canary Lab showcase shared by CLI discovery, docsite, and Storybook
10+
*/
11+
12+
import {useId, useState} from 'react';
13+
import * as stylex from '@stylexjs/stylex';
14+
import {DialogHeroHeader} from '@astryxdesign/lab';
15+
import {Button} from '@astryxdesign/core/Button';
16+
import {Dialog} from '@astryxdesign/core/Dialog';
17+
import {Layout, LayoutContent, LayoutFooter} from '@astryxdesign/core/Layout';
18+
import {Text} from '@astryxdesign/core/Text';
19+
20+
const styles = stylex.create({
21+
artwork: {
22+
display: 'block',
23+
},
24+
});
25+
26+
export default function DialogHeroHeaderShowcase() {
27+
const [isOpen, setIsOpen] = useState(true);
28+
const gradientId = useId();
29+
30+
return isOpen ? (
31+
<Dialog isOpen isInline onOpenChange={setIsOpen}>
32+
<Layout
33+
header={
34+
<DialogHeroHeader
35+
title="Make room for your next idea"
36+
media={
37+
<svg
38+
viewBox="0 0 480 180"
39+
width="100%"
40+
height="180"
41+
preserveAspectRatio="xMidYMid slice"
42+
aria-hidden="true"
43+
{...stylex.props(styles.artwork)}>
44+
<defs>
45+
<linearGradient id={gradientId} x1="0" y1="0" x2="1" y2="1">
46+
<stop offset="0%" stopColor="#1c2340" />
47+
<stop offset="100%" stopColor="#3b2d5e" />
48+
</linearGradient>
49+
</defs>
50+
<rect width="480" height="180" fill={`url(#${gradientId})`} />
51+
<circle cx="390" cy="40" r="70" fill="#8ba7ff" opacity="0.35" />
52+
<circle cx="70" cy="170" r="90" fill="#8ba7ff" opacity="0.25" />
53+
<circle cx="240" cy="90" r="42" fill="#8ba7ff" opacity="0.55" />
54+
</svg>
55+
}
56+
mediaMode="dark"
57+
onOpenChange={setIsOpen}
58+
/>
59+
}
60+
content={
61+
<LayoutContent>
62+
<Text type="body">
63+
Bring your notes, projects, and collaborators together in one
64+
workspace. You can make it your own as you go.
65+
</Text>
66+
</LayoutContent>
67+
}
68+
footer={
69+
<LayoutFooter>
70+
<Button
71+
label="Get started"
72+
variant="primary"
73+
onClick={() => setIsOpen(false)}
74+
/>
75+
</LayoutFooter>
76+
}
77+
/>
78+
</Dialog>
79+
) : (
80+
<Button
81+
label="Preview welcome dialog"
82+
variant="secondary"
83+
onClick={() => setIsOpen(true)}
84+
/>
85+
);
86+
}

0 commit comments

Comments
 (0)