Skip to content

Commit 835ba2c

Browse files
authored
chore: fix code rendering for Dialog Container example story (#9028)
1 parent ecc7c98 commit 835ba2c

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

packages/@react-spectrum/s2/stories/Dialog.stories.tsx

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,25 @@ function DialogContainerExampleRender(props: ExampleDialogProps): ReactElement {
155155

156156
export const DialogContainerExample: StoryObj<typeof DialogContainerExampleRender> = {
157157
render: (args) => <DialogContainerExampleRender {...args} />,
158-
args: DialogTriggerExample.args
158+
args: DialogTriggerExample.args,
159+
parameters: {
160+
docs: {
161+
source: {
162+
transform: () => {
163+
return `
164+
let [isOpen, setOpen] = useState(false);
165+
166+
<Button variant="accent" onPress={() => setOpen(true)}>Open dialog</Button>
167+
<DialogContainer onDismiss={() => setOpen(false)} {...props}>
168+
{isOpen &&
169+
<ExampleDialog {...props} />
170+
}
171+
</DialogContainer>
172+
`;
173+
}
174+
}
175+
}
176+
}
159177
};
160178

161179
export const ColorScheme: StoryObj<typeof ExampleDialog> = {

0 commit comments

Comments
 (0)