Skip to content

Commit 58642a7

Browse files
committed
Fix dropped props between Tour and Hint
1 parent c77c118 commit 58642a7

File tree

2 files changed

+32
-20
lines changed

2 files changed

+32
-20
lines changed

apps/smithy/src/stories/Tour/Tour.stories.tsx

Lines changed: 26 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Box, Button, Tour, type TourProps } from "@frigade/react";
22
import { StoryContext, StoryFn } from "@storybook/react";
3-
import { useEffect, useRef } from "react";
3+
import { useEffect, useRef, useState } from "react";
44

55
export default {
66
title: "Components/Tour",
@@ -23,28 +23,33 @@ export const Default = {
2323
},
2424
decorators: [
2525
(_: StoryFn, options: StoryContext) => {
26-
// const [open, setOpen] = useState(true);
26+
const [, setForceRender] = useState(Math.random());
27+
const [open, setOpen] = useState(true);
2728
// const { flow } = useFlow("flow_U63A5pndRrvCwxNs");
2829

2930
const lateAnchorRef = useRef(null);
3031

3132
useEffect(() => {
32-
// @ts-expect-error Shush TypeScript, it's a debug ref in a story, it's fine
33-
lateAnchorRef.current = (
34-
<Box
35-
borderRadius="10px"
36-
id="tooltip-storybook-0"
37-
p={4}
38-
style={{ background: "pink", width: "200px" }}
39-
>
40-
<Button.Primary
41-
title="Anchor here"
42-
onClick={() => {
43-
// no-op
44-
}}
45-
/>
46-
</Box>
47-
);
33+
setTimeout(() => {
34+
// @ts-expect-error Shush TypeScript, it's a debug ref in a story, it's fine
35+
lateAnchorRef.current = (
36+
<Box
37+
borderRadius="10px"
38+
id="tooltip-storybook-0"
39+
p={4}
40+
style={{ background: "pink", width: "200px" }}
41+
>
42+
<Button.Primary
43+
title="Anchor here"
44+
onClick={() => {
45+
// no-op
46+
}}
47+
/>
48+
</Box>
49+
);
50+
51+
setForceRender(Math.random());
52+
}, 333);
4853
}, []);
4954

5055
return (
@@ -77,11 +82,12 @@ export const Default = {
7782
Second anchor
7883
</Box>
7984
<Tour
80-
// onOpenChange={setOpen}
81-
// open={open}
85+
onOpenChange={setOpen}
86+
open={open}
8287
// variables={{
8388
// firstName: "John",
8489
// }}
90+
onSecondary={() => setOpen(false)}
8591
{...(options.args as TourProps)}
8692
/>
8793
</Box>

packages/react/src/components/Tour/Tour.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,8 @@ export function Tour({ as, flowId, ...props }: TourProps) {
8383
container = 'body',
8484
defaultOpen,
8585
modal,
86+
onOpenChange,
87+
open,
8688
part,
8789
sequential = true,
8890
side = 'bottom',
@@ -104,6 +106,8 @@ export function Tour({ as, flowId, ...props }: TourProps) {
104106
modal,
105107
onPrimary,
106108
onSecondary,
109+
onOpenChange,
110+
open,
107111
part,
108112
side,
109113
sideOffset,
@@ -166,6 +170,8 @@ export function Tour({ as, flowId, ...props }: TourProps) {
166170
handleDismiss: handleDismissStep,
167171
onPrimary,
168172
onSecondary,
173+
onOpenChange,
174+
open,
169175
part,
170176
side,
171177
sideOffset,

0 commit comments

Comments
 (0)