Skip to content

Commit

Permalink
add forwardRef to MenuButton
Browse files Browse the repository at this point in the history
  • Loading branch information
andreymikhadyuk committed Sep 27, 2023
1 parent 10f88d1 commit 5fb53fa
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/shared/ui-kit/MenuButton/MenuButton.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { FC } from "react";
import React, { forwardRef, ForwardRefRenderFunction } from "react";
import { Orientation } from "@/shared/constants";
import { MenuIcon } from "@/shared/icons";
import { ButtonVariant } from "../Button";
Expand All @@ -10,15 +10,17 @@ interface MenuButtonProps {
variant?: ButtonVariant;
}

const MenuButton: FC<MenuButtonProps> = ({
onClick,
variant = ButtonVariant.PrimaryGray,
}) => {
const MenuButton: ForwardRefRenderFunction<
HTMLButtonElement,
MenuButtonProps
> = (props, ref) => {
const { onClick, variant = ButtonVariant.PrimaryGray } = props;

return (
<ButtonIcon variant={variant} onClick={onClick}>
<ButtonIcon ref={ref} variant={variant} onClick={onClick}>
<MenuIcon className={styles.icon} variant={Orientation.Vertical} />
</ButtonIcon>
);
};

export default MenuButton;
export default forwardRef(MenuButton);

0 comments on commit 5fb53fa

Please sign in to comment.