From 153c04b47af57eb676821179c96ce21e48cd1fa4 Mon Sep 17 00:00:00 2001 From: Borris Date: Thu, 8 Aug 2024 17:04:29 +0400 Subject: [PATCH] initial open on the code preview --- apps/astro-docs/src/components/code-block-wrapper.tsx | 4 +++- apps/astro-docs/src/content/docs/components/accordion.mdx | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/apps/astro-docs/src/components/code-block-wrapper.tsx b/apps/astro-docs/src/components/code-block-wrapper.tsx index c88bccc..dbbc0dd 100644 --- a/apps/astro-docs/src/components/code-block-wrapper.tsx +++ b/apps/astro-docs/src/components/code-block-wrapper.tsx @@ -12,15 +12,17 @@ import { interface CodeBlockProps extends React.HTMLAttributes { expandButtonTitle?: string; + initialOpen?: boolean; } export function CodeBlockWrapper({ expandButtonTitle = 'View Code', className = 'my-6 overflow-hidden rounded-md', children, + initialOpen = false, ...props }: CodeBlockProps) { - const [isOpened, setIsOpened] = React.useState(false); + const [isOpened, setIsOpened] = React.useState(initialOpen); return ( setIsOpened(open)}> diff --git a/apps/astro-docs/src/content/docs/components/accordion.mdx b/apps/astro-docs/src/content/docs/components/accordion.mdx index 13c0b84..0b95ac1 100644 --- a/apps/astro-docs/src/content/docs/components/accordion.mdx +++ b/apps/astro-docs/src/content/docs/components/accordion.mdx @@ -21,7 +21,7 @@ A vertically stacked set of interactive headings that each reveal a section of c - +