From 53cbfd981f88cd999c40ca72eb559a893b646ed3 Mon Sep 17 00:00:00 2001 From: Manuel Date: Thu, 11 Jan 2024 14:34:23 +0100 Subject: [PATCH] fix(components): pass defaultOpen state to disclosure parent --- .../disclosure/disclosure.stories.tsx | 19 +++++++++++++++++++ src/components/disclosure/disclosure.tsx | 10 ++++++++-- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/src/components/disclosure/disclosure.stories.tsx b/src/components/disclosure/disclosure.stories.tsx index ec7477c9..f2cf392e 100644 --- a/src/components/disclosure/disclosure.stories.tsx +++ b/src/components/disclosure/disclosure.stories.tsx @@ -44,3 +44,22 @@ export const Stacked: Story = { ), }; + +export const DefaultOpen: Story = { + render: () => ( +
+ + Disclosure Button + Disclosure Content + + + Disclosure Button + Disclosure Content + + + Disclosure Button + Disclosure Content + +
+ ), +}; diff --git a/src/components/disclosure/disclosure.tsx b/src/components/disclosure/disclosure.tsx index 01c9b9e2..abdb6331 100644 --- a/src/components/disclosure/disclosure.tsx +++ b/src/components/disclosure/disclosure.tsx @@ -33,8 +33,14 @@ const DisclosureButton = ({ children, ...props }: DisclosureButtonProps) => { ); }; -const Disclosure = ({ children }: { children: React.ReactNode }) => { - return {children}; +const Disclosure = ({ + children, + defaultOpen = false, +}: { + children: React.ReactNode; + defaultOpen?: boolean; +}) => { + return {children}; }; Disclosure.Button = DisclosureButton;