Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions src/components/overlays/DialogOverlay/DialogOverlay.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,13 @@
type Subject = { name: string };
const overlay = DialogOverlay.useOverlayWithSubject<Subject>();

const activatorFor = (subject: Subject) => () => {
// Note: do not activate again if the subject is already shown
if (!overlay.props.popoverRef?.current?.active || subject.name !== overlay.subject?.name) {

Check failure on line 57 in src/components/overlays/DialogOverlay/DialogOverlay.stories.tsx

View workflow job for this annotation

GitHub Actions / build (24.x)

Property 'current' does not exist on type '((instance: PopoverRef | null) => void | (() => VoidOrUndefinedOnly)) | RefObject<PopoverRef | null>'.

Check failure on line 57 in src/components/overlays/DialogOverlay/DialogOverlay.stories.tsx

View workflow job for this annotation

GitHub Actions / build (22.x)

Property 'current' does not exist on type '((instance: PopoverRef | null) => void | (() => VoidOrUndefinedOnly)) | RefObject<PopoverRef | null>'.

Check failure on line 57 in src/components/overlays/DialogOverlay/DialogOverlay.stories.tsx

View workflow job for this annotation

GitHub Actions / build (24.x)

Property 'current' does not exist on type '((instance: PopoverRef | null) => void | (() => VoidOrUndefinedOnly)) | RefObject<PopoverRef | null>'.

Check failure on line 57 in src/components/overlays/DialogOverlay/DialogOverlay.stories.tsx

View workflow job for this annotation

GitHub Actions / build (22.x)

Property 'current' does not exist on type '((instance: PopoverRef | null) => void | (() => VoidOrUndefinedOnly)) | RefObject<PopoverRef | null>'.
overlay.activateWith(subject);
}
};

return (
<article className="bk-prose">
{overlay.subject &&
Expand All @@ -63,15 +70,15 @@
<p>A single details overlay will be used, filled in with the subject based on which name was pressed.</p>

<p>
<Button kind="primary" label="Open: Alice" onPress={() => { overlay.activateWith({ name: 'Alice' }); }}/>
<Button kind="primary" label="Open: Alice" onPress={activatorFor({ name: 'alice' })}/>
</p>
<p>
<Button kind="primary" label="Open: Bob" onPress={() => { overlay.activateWith({ name: 'Bob' }); }}/>
<Button kind="primary" label="Open: Bob" onPress={activatorFor({ name: 'bob' })}/>
</p>
</article>
);
};
export const DialogModalWithSubject: Story = {
export const DialogOverlayWithSubject: Story = {
args: {
trigger: undefined,
},
Expand Down
Loading