Skip to content

Commit 853fdc2

Browse files
committed
fix(lab): the DialogHeroHeader showcase stays open, so focus never falls to the page; the Showcase story comes with its block
1 parent 718be2c commit 853fdc2

2 files changed

Lines changed: 14 additions & 17 deletions

File tree

‎apps/storybook/stories/DialogHeroHeader.stories.tsx‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ import {Heading} from '@astryxdesign/core/Heading';
3030
import {Icon} from '@astryxdesign/core/Icon';
3131
import {Text} from '@astryxdesign/core/Text';
3232
import * as stylex from '@stylexjs/stylex';
33+
import DialogHeroHeaderShowcase from '../../../packages/lab/blocks/DialogHeroHeaderShowcase';
3334

3435
const styles = stylex.create({
3536
heroSvg: {
@@ -76,6 +77,11 @@ const meta: Meta<typeof DialogHeroHeader> = {
7677
export default meta;
7778
type Story = StoryObj<typeof DialogHeroHeader>;
7879

80+
/** The same block is discoverable through the Lab integration and canary docsite. */
81+
export const Showcase: Story = {
82+
render: () => <DialogHeroHeaderShowcase />,
83+
};
84+
7985
/**
8086
* The hero header drops into Layout's header slot exactly like DialogHeader.
8187
* The media bleeds to the dialog's edges; the close button overlays its

‎packages/lab/blocks/DialogHeroHeaderShowcase.tsx‎

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55
/**
66
* @file DialogHeroHeaderShowcase.tsx
77
* @input DialogHeroHeader composed with Dialog and Layout
8-
* @output A dismissible onboarding preview with full-bleed decorative media
8+
* @output A static onboarding preview with full-bleed decorative media
99
* @position Canary Lab showcase shared by CLI discovery, docsite, and Storybook
1010
*/
1111

12-
import {useId, useState} from 'react';
12+
import {useId} from 'react';
1313
import * as stylex from '@stylexjs/stylex';
1414
import {DialogHeroHeader} from '@astryxdesign/lab';
1515
import {Button} from '@astryxdesign/core/Button';
@@ -23,12 +23,13 @@ const styles = stylex.create({
2323
},
2424
});
2525

26+
// The preview stays open: closing would unmount the focused control and drop
27+
// keyboard focus to the page.
2628
export default function DialogHeroHeaderShowcase() {
27-
const [isOpen, setIsOpen] = useState(true);
2829
const gradientId = useId();
2930

30-
return isOpen ? (
31-
<Dialog isOpen isInline onOpenChange={setIsOpen}>
31+
return (
32+
<Dialog isOpen isInline onOpenChange={() => {}}>
3233
<Layout
3334
header={
3435
<DialogHeroHeader
@@ -54,7 +55,7 @@ export default function DialogHeroHeaderShowcase() {
5455
</svg>
5556
}
5657
mediaMode="dark"
57-
onOpenChange={setIsOpen}
58+
onOpenChange={() => {}}
5859
/>
5960
}
6061
content={
@@ -67,20 +68,10 @@ export default function DialogHeroHeaderShowcase() {
6768
}
6869
footer={
6970
<LayoutFooter>
70-
<Button
71-
label="Get started"
72-
variant="primary"
73-
onClick={() => setIsOpen(false)}
74-
/>
71+
<Button label="Get started" variant="primary" />
7572
</LayoutFooter>
7673
}
7774
/>
7875
</Dialog>
79-
) : (
80-
<Button
81-
label="Preview welcome dialog"
82-
variant="secondary"
83-
onClick={() => setIsOpen(true)}
84-
/>
8576
);
8677
}

0 commit comments

Comments
 (0)