Files
supabase/apps/docs/components/reference/RefDetailCollapse.tsx
Ivan Vasilov 05a542ccea chore: Migrate all feather icons to lucide icons (#29038)
* Add lucide-react to docs (to make the autocomplete work).

* Migrate the docs app icons.

* Migrate the ui-patterns.

* Remove the old icons from ui package.

* Migrate the www app from react-feather icons.

* Migrate all of studio icons.

* Migrate the only component in design-system.

* Fix an old import in ui package. Revert an import in docs app.

* Fix some pages in www.

* Remove unneeded files used in generation of icons.

* Fix a prettier error.

* Fix more issues in www.

* Fix an issue in Log Date picker.

* Replace all string sizes with number sizes because the icons grew in some cases.

* Fix more imports in security page.

* Fix an extra import.

* Remove the size prop from all icons if they're in a button and they match the button size.

* Minor fixes for docs and www.

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2024-09-04 19:46:21 +08:00

43 lines
1.4 KiB
TypeScript

import * as Accordion from '@radix-ui/react-accordion'
import { ChevronRight } from 'lucide-react'
import React from 'react'
const RefDetailCollapse: React.FC<
React.PropsWithChildren<{ id: string; label: string; defaultOpen?: boolean }>
> = ({ defaultOpen = true, ...props }) => {
return (
<Accordion.Root
className="AccordionRoot"
type="single"
defaultValue={defaultOpen ? `${props.id}` : ''}
collapsible
>
<Accordion.Item className="AccordionItem" value={`${props.id}`}>
<Accordion.Trigger asChild>
<button
className={[
'transition-all ease-out',
'h-8',
'bg-surface-100 data-open:bg-surface-200',
'border w-full flex items-center gap-3 px-5',
'rounded-tl rounded-tr',
'data-closed:rounded-bl data-closed:rounded-br',
'text-foreground-light text-xs',
].join(' ')}
>
<div className="data-open-parent:rotate-90 text-foreground-lighter">
<ChevronRight size={12} strokeWidth={2} />
</div>
{props.label}
</button>
</Accordion.Trigger>
<Accordion.Content className="transition data-open:animate-slide-down data-closed:animate-slide-up">
{props.children}
</Accordion.Content>
</Accordion.Item>
</Accordion.Root>
)
}
export default RefDetailCollapse