Skip to content

Commit

Permalink
fix: handling Users Custom onClick event as well
Browse files Browse the repository at this point in the history
  • Loading branch information
dhavalveera authored and SutuSebastian committed Feb 5, 2024
1 parent 37bcb68 commit a733e74
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/components/Navbar/NavbarLink.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use client';

import type { ComponentProps, ElementType, FC } from 'react';
import type { ComponentProps, ElementType, FC, MouseEvent } from 'react';
import { twMerge } from 'tailwind-merge';
import { mergeDeep } from '../../helpers/merge-deep';
import type { DeepPartial } from '../../types';
Expand Down Expand Up @@ -28,14 +28,16 @@ export const NavbarLink: FC<NavbarLinkProps> = ({
children,
className,
theme: customTheme = {},
onClick: userOnClick,
...props
}) => {
const { theme: rootTheme, isOpen, setIsOpen } = useNavbarContext();

const theme = mergeDeep(rootTheme.link, customTheme);

const handleClick = () => {
const handleClick = (event: MouseEvent<HTMLAnchorElement>) => {
setIsOpen(!isOpen);
userOnClick && userOnClick(event);
};

return (
Expand Down

0 comments on commit a733e74

Please sign in to comment.