Skip to content

An open source design system that's fully customizable and agent ready

TypeScript

feat(lab): DialogHeroHeader showcase, and astryx discover lists it (#10109)

Cindy Zhangf9cd81f1480c
diff --git a/.changeset/astryx-discover-lists-the-lab-dialogheroheader-c-dhhr.md b/.changeset/astryx-discover-lists-the-lab-dialogheroheader-c-dhhr.md
new file mode 100644
index 0000000000..b8eff1a956
--- /dev/null
+++ b/.changeset/astryx-discover-lists-the-lab-dialogheroheader-c-dhhr.md
@@ -0,0 +1,6 @@
+---
+'@astryxdesign/cli': patch
+---
+
+[feat] `astryx discover` lists the Lab DialogHeroHeaderShowcase template from `@astryxdesign/lab`. (#4182)
+@jiunshinn
diff --git a/apps/storybook/stories/DialogHeroHeader.stories.tsx b/apps/storybook/stories/DialogHeroHeader.stories.tsx
index 4c124c45aa..3e26664a8b 100644
--- a/apps/storybook/stories/DialogHeroHeader.stories.tsx
+++ b/apps/storybook/stories/DialogHeroHeader.stories.tsx
@@ -30,6 +30,7 @@ import {Heading} from '@astryxdesign/core/Heading';
import {Icon} from '@astryxdesign/core/Icon';
import {Text} from '@astryxdesign/core/Text';
import * as stylex from '@stylexjs/stylex';
+import DialogHeroHeaderShowcase from '../../../packages/lab/blocks/DialogHeroHeaderShowcase';
const styles = stylex.create({
heroSvg: {
@@ -76,6 +77,11 @@ const meta: Meta<typeof DialogHeroHeader> = {
export default meta;
type Story = StoryObj<typeof DialogHeroHeader>;
+/** The same block is discoverable through the Lab integration and canary docsite. */
+export const Showcase: Story = {
+ render: () => <DialogHeroHeaderShowcase />,
+};
+
/**
* The hero header drops into Layout's header slot exactly like DialogHeader.
* The media bleeds to the dialog's edges; the close button overlays its
diff --git a/internal/shadcn-registry/routes.lock.json b/internal/shadcn-registry/routes.lock.json
index cc55591b68..7c972142e6 100644
--- a/internal/shadcn-registry/routes.lock.json
+++ b/internal/shadcn-registry/routes.lock.json
@@ -4716,6 +4716,11 @@
"path": "showcases/dialog-header/default",
"aliases": []
},
+ {
+ "name": "showcase-dialog-hero-header-default",
+ "path": "showcases/dialog-hero-header/default",
+ "aliases": []
+ },
{
"name": "showcase-dialog-default",
"path": "showcases/dialog/default",
diff --git a/packages/cli/assets/discover/official-packages.json b/packages/cli/assets/discover/official-packages.json
index 939c6cd8d0..82b1d14d9e 100644
--- a/packages/cli/assets/discover/official-packages.json
+++ b/packages/cli/assets/discover/official-packages.json
@@ -260,6 +260,10 @@
"kind": "template",
"name": "CommentThreadShowcase"
},
+ {
+ "kind": "template",
+ "name": "DialogHeroHeaderShowcase"
+ },
{
"kind": "template",
"name": "DiffViewerShowcase"
diff --git a/packages/lab/blocks/DialogHeroHeaderShowcase.doc.mjs b/packages/lab/blocks/DialogHeroHeaderShowcase.doc.mjs
new file mode 100644
index 0000000000..ea93c85328
--- /dev/null
+++ b/packages/lab/blocks/DialogHeroHeaderShowcase.doc.mjs
@@ -0,0 +1,29 @@
+// Copyright (c) Meta Platforms, Inc. and affiliates.
+
+/**
+ * @file DialogHeroHeaderShowcase.doc.mjs
+ * @input DialogHeroHeaderShowcase.tsx
+ * @output Showcase ownership and preview metadata
+ * @position Lab integration template registration for DialogHeroHeader
+ */
+
+/** @type {import('@astryxdesign/cli/authoring').TemplateDoc} */
+export default {
+ type: 'block',
+ name: 'DialogHeroHeader',
+ displayName: 'Dialog Hero Header',
+ description:
+ 'An onboarding dialog with full-bleed artwork and an overlaid close button.',
+ exampleFor: 'DialogHeroHeader',
+ isShowcase: true,
+ aspectRatio: 4 / 3,
+ componentsUsed: [
+ 'DialogHeroHeader',
+ 'Dialog',
+ 'Layout',
+ 'LayoutContent',
+ 'LayoutFooter',
+ 'Button',
+ 'Text',
+ ],
+};
diff --git a/packages/lab/blocks/DialogHeroHeaderShowcase.tsx b/packages/lab/blocks/DialogHeroHeaderShowcase.tsx
new file mode 100644
index 0000000000..d8fa81a080
--- /dev/null
+++ b/packages/lab/blocks/DialogHeroHeaderShowcase.tsx
@@ -0,0 +1,77 @@
+// Copyright (c) Meta Platforms, Inc. and affiliates.
+
+'use client';
+
+/**
+ * @file DialogHeroHeaderShowcase.tsx
+ * @input DialogHeroHeader composed with Dialog and Layout
+ * @output A static onboarding preview with full-bleed decorative media
+ * @position Canary Lab showcase shared by CLI discovery, docsite, and Storybook
+ */
+
+import {useId} from 'react';
+import * as stylex from '@stylexjs/stylex';
+import {DialogHeroHeader} from '@astryxdesign/lab';
+import {Button} from '@astryxdesign/core/Button';
+import {Dialog} from '@astryxdesign/core/Dialog';
+import {Layout, LayoutContent, LayoutFooter} from '@astryxdesign/core/Layout';
+import {Text} from '@astryxdesign/core/Text';
+
+const styles = stylex.create({
+ artwork: {
+ display: 'block',
+ },
+});
+
+// The preview stays open: closing would unmount the focused control and drop
+// keyboard focus to the page.
+export default function DialogHeroHeaderShowcase() {
+ const gradientId = useId();
+
+ return (
+ <Dialog isOpen isInline onOpenChange={() => {}}>
+ <Layout
+ header={
+ <DialogHeroHeader
+ title="Make room for your next idea"
+ media={
+ <svg
+ viewBox="0 0 480 180"
+ width="100%"
+ height="180"
+ preserveAspectRatio="xMidYMid slice"
+ aria-hidden="true"
+ {...stylex.props(styles.artwork)}>
+ <defs>
+ <linearGradient id={gradientId} x1="0" y1="0" x2="1" y2="1">
+ <stop offset="0%" stopColor="#1c2340" />
+ <stop offset="100%" stopColor="#3b2d5e" />
+ </linearGradient>
+ </defs>
+ <rect width="480" height="180" fill={`url(#${gradientId})`} />
+ <circle cx="390" cy="40" r="70" fill="#8ba7ff" opacity="0.35" />
+ <circle cx="70" cy="170" r="90" fill="#8ba7ff" opacity="0.25" />
+ <circle cx="240" cy="90" r="42" fill="#8ba7ff" opacity="0.55" />
+ </svg>
+ }
+ mediaMode="dark"
+ onOpenChange={() => {}}
+ />
+ }
+ content={
+ <LayoutContent>
+ <Text type="body">
+ Bring your notes, projects, and collaborators together in one
+ workspace. You can make it your own as you go.
+ </Text>
+ </LayoutContent>
+ }
+ footer={
+ <LayoutFooter>
+ <Button label="Get started" variant="primary" />
+ </LayoutFooter>
+ }
+ />
+ </Dialog>
+ );
+}