Skip to content

Commit

Permalink
refactor: restore applying style through navigation component
Browse files Browse the repository at this point in the history
  • Loading branch information
timoheddes committed Aug 14, 2023
1 parent 2de11c2 commit 01640a1
Showing 1 changed file with 14 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
import { NavGlow } from './assets/glow';
import { glowClass, navListClass, navWrapperClass } from './NavHeader.css';
import {
activeLinkClass,
glowClass,
linkClass,
navListClass,
navWrapperClass,
} from './NavHeader.css';
import { INavHeaderLinkProps } from './NavHeaderLink';
import useGlow from './useGlow';

import classNames from 'classnames';
import React, { FC, FunctionComponentElement } from 'react';

export type INavItemTarget = '_self' | '_blank';
Expand All @@ -15,13 +22,15 @@ export type INavItems = INavItem[];

export interface INavHeaderNavigationProps {
children: FunctionComponentElement<INavHeaderLinkProps>[];
activeLink?: number;
}

export const NavHeaderNavigation: FC<INavHeaderNavigationProps> = ({
children,
activeLink,
}) => {
const { glowX, animationDuration, glowRef, navRef, activeNav, setActiveNav } =
useGlow();
useGlow(activeLink);

return (
<nav className={navWrapperClass} ref={navRef}>
Expand All @@ -46,6 +55,9 @@ export const NavHeaderNavigation: FC<INavHeaderNavigationProps> = ({
>,
{
active: activeNav === index + 1,
className: classNames(linkClass, {
[activeLinkClass]: activeNav === index + 1,
}),
},
)}
</li>
Expand Down

0 comments on commit 01640a1

Please sign in to comment.