Skip to content

Commit

Permalink
Probably don't need to export the type for the menu props
Browse files Browse the repository at this point in the history
  • Loading branch information
Dantemss committed Jan 19, 2024
1 parent b0c5e45 commit 4cf1007
Showing 1 changed file with 9 additions and 15 deletions.
24 changes: 9 additions & 15 deletions src/components/DropdownMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -174,22 +174,20 @@ const DropdownMenuItemContainer = ({
</StyledDropdownMenuItemContainer>;
};

export type DropdownMenuProps = {
disabled?: boolean;
id: string;
text: string;
variant: ButtonVariant;
width?: string;
};

export const DropdownMenu = ({
children,
disabled,
id,
text,
variant,
children,
width,
}: React.PropsWithChildren<DropdownMenuProps>) => {
}: React.PropsWithChildren<{
disabled?: boolean;
id: string;
text: string;
variant: ButtonVariant;
width?: string;
}>) => {
const ref = React.useRef<HTMLDivElement>(null);

const state = useDropdownMenu({ disabled });
Expand Down Expand Up @@ -225,17 +223,13 @@ export const DropdownMenu = ({
</StyledDropdownMenu>;
};

export type DropdownMenuItemButtonProps = React.PropsWithChildren<React.HTMLAttributes<HTMLButtonElement>>;

const firstSibling = (element: Element) => element.parentElement?.firstElementChild;
const lastSibling = (element: Element) => element.parentElement?.lastElementChild;
const nextWithWraparound = (element: Element) => element.nextElementSibling ?? firstSibling(element);
const previousWithWraparound = (element: Element) => element.previousElementSibling ?? lastSibling(element);

export const DropdownMenuItemButton = ({
children,
onClick,
...buttonProps
children, onClick, ...buttonProps
}: React.PropsWithChildren<React.HTMLAttributes<HTMLButtonElement>>) => {
const { closeMenu } = React.useContext(DropdownMenuContext);

Expand Down

0 comments on commit 4cf1007

Please sign in to comment.