|
1 | 1 | import * as React from "react";
|
2 |
| -import { useState } from "react"; |
| 2 | +import cx from "classnames"; |
3 | 3 |
|
4 | 4 | import { styles } from "../constants/styles";
|
5 | 5 | import { close, logo, menu } from "../assets";
|
6 | 6 | import { navLinks } from "../constants/constants";
|
7 | 7 |
|
8 | 8 | const Header: React.FC = (): JSX.Element => {
|
9 |
| - const [isNavOpen, setIsNavOpen] = useState<boolean>(false); |
10 |
| - const [isActive, setIsActive] = useState<string>("#"); |
| 9 | + const [isNavOpen, setIsNavOpen] = React.useState<boolean>(false); |
| 10 | + const [isActive, setIsActive] = React.useState<string>("#"); |
11 | 11 |
|
12 | 12 | const handleToggleNav = (): void => setIsNavOpen(prev => !prev);
|
13 | 13 |
|
14 | 14 | return (
|
15 |
| - <header className="bg-primary py-6 z-[100] sticky top-0"> |
16 |
| - <div className={styles.flexBetween + " " + styles.container}> |
| 15 | + <header className="bg-primary py-3 z-[100] sticky top-0"> |
| 16 | + <div className={cx(styles.flexBetween, styles.container)}> |
17 | 17 | <img className="w-[130px] cursor-pointer" src={logo} alt="logo quick-pay" />
|
18 | 18 |
|
19 | 19 | <button className="sm:hidden inline-flex" onClick={handleToggleNav}>
|
20 | 20 | <img className="w-[24px] h-[24px] object-contain" src={isNavOpen ? close : menu} alt="nav toggler" />
|
21 | 21 | </button>
|
22 | 22 |
|
23 | 23 | <nav
|
24 |
| - className={`${ |
| 24 | + className={cx( |
| 25 | + "bg-primary sm:bg-transparent w-full sm:w-auto left-0 absolute sm:static top-[89px] sm:block sidebar py-4 px-3 sm:py-0 sm:px-0", |
25 | 26 | isNavOpen ? "block" : "hidden"
|
26 |
| - } bg-primary sm:bg-transparent w-full sm:w-auto left-0 absolute sm:static top-[89px] sm:block sidebar py-4 px-3 sm:py-0 sm:px-0`} |
| 27 | + )} |
27 | 28 | >
|
28 | 29 | <ul className="list-none flex w-full sm:w-auto flex-wrap sm:flex-nowrap justify-center sm:justify-end">
|
29 | 30 | {navLinks.map(({ title, path }) => (
|
30 | 31 | <li
|
31 |
| - className={`${ |
| 32 | + className={cx( |
| 33 | + "sm:[&:not(:last-child)]:mr-9 mx-2 font-montserrat font-medium sm:font-normal hover:text-secondary transition-all duration-500", |
32 | 34 | isActive === path ? "text-white" : "text-lightWhite"
|
33 |
| - } sm:[&:not(:last-child)]:mr-9 mx-2 font-montserrat font-medium sm:font-normal hover:text-secondary transition-all duration-500`} |
| 35 | + )} |
34 | 36 | key={path}
|
35 | 37 | >
|
36 | 38 | <a className="text-inherit" href={path} onClick={(): void => setIsActive(path)}>
|
|
0 commit comments