feat: add dropdown for links and collection header

This commit is contained in:
Sonny
2024-05-13 00:04:01 +02:00
committed by Sonny
parent 0f1dc9b69c
commit 2f0e1dd375
13 changed files with 204 additions and 131 deletions

View File

@@ -32,9 +32,11 @@ const DropdownStyle = styled.div<{ opened: boolean }>(({ opened, theme }) => ({
export default function Dropdown({
children,
label,
className,
}: {
children: ReactNode;
label: ReactNode | string;
className?: string;
}) {
const dropdownRef = useRef<HTMLDivElement>(null);
const { isShowing, toggle, close } = useToggle();
@@ -48,7 +50,12 @@ export default function Dropdown({
});
return (
<DropdownStyle opened={isShowing} onClick={toggle} ref={dropdownRef}>
<DropdownStyle
opened={isShowing}
onClick={toggle}
ref={dropdownRef}
className={className}
>
<DropdownLabel>{label}</DropdownLabel>
<DropdownContainer show={isShowing}>{children}</DropdownContainer>
</DropdownStyle>