mirror of
https://github.com/yangshun/tech-interview-handbook.git
synced 2025-07-27 04:03:26 +08:00
[ui][collapsible] add defaultOpen prop (#314)
This commit is contained in:
@ -5,12 +5,13 @@ import { ChevronDownIcon } from '@heroicons/react/20/solid';
|
|||||||
|
|
||||||
type Props = Readonly<{
|
type Props = Readonly<{
|
||||||
children: ReactNode;
|
children: ReactNode;
|
||||||
|
defaultOpen?: boolean;
|
||||||
label: string;
|
label: string;
|
||||||
}>;
|
}>;
|
||||||
|
|
||||||
export default function Collapsible({ children, label }: Props) {
|
export default function Collapsible({ children, defaultOpen, label }: Props) {
|
||||||
return (
|
return (
|
||||||
<Disclosure>
|
<Disclosure defaultOpen={defaultOpen}>
|
||||||
{({ open }) => (
|
{({ open }) => (
|
||||||
<>
|
<>
|
||||||
<Disclosure.Button className="text-primary-900 hover:bg-primary-100 focus-visible:ring-primary-500 -mx-2.5 box-content flex w-full justify-between rounded-lg px-2.5 py-2 text-left text-sm font-medium focus:outline-none focus-visible:ring focus-visible:ring-opacity-75">
|
<Disclosure.Button className="text-primary-900 hover:bg-primary-100 focus-visible:ring-primary-500 -mx-2.5 box-content flex w-full justify-between rounded-lg px-2.5 py-2 text-left text-sm font-medium focus:outline-none focus-visible:ring focus-visible:ring-opacity-75">
|
||||||
|
Reference in New Issue
Block a user