From 6a09b57f341fef494dc70a2685097e94c94220b7 Mon Sep 17 00:00:00 2001 From: Hossein Mehrabi Date: Mon, 28 Aug 2023 13:13:32 +0330 Subject: [PATCH] fix: fix mobile navbar icons --- src/components/NavBar/NavBar.tsx | 64 ++++++++++++++++++++++---------- 1 file changed, 45 insertions(+), 19 deletions(-) diff --git a/src/components/NavBar/NavBar.tsx b/src/components/NavBar/NavBar.tsx index 9d0b56e..313d60e 100644 --- a/src/components/NavBar/NavBar.tsx +++ b/src/components/NavBar/NavBar.tsx @@ -1,11 +1,13 @@ import { NavbarLinks } from '@/components/NavBar/Navbar.Links' import { NavbarMobileMenu } from '@/components/NavBar/Navbar.MobileMenu' +import { SocialMediaKit } from '@/components/NavBar/Navbar.SocialMediaKit' import { ThemeSwitch } from '@/components/ThemeSwitch/ThemeSwitch' import { NavLinksItems } from '@/configs/data.configs' import { uiConfigs } from '@/configs/ui.configs' import { useThemeState } from '@/states/themeState' import { useScrollDirection } from '@/utils/ui.utils' import { + CloseIcon, IconButton, MenuIcon, SearchIcon, @@ -16,8 +18,8 @@ import Link from 'next/link' import { useRouter } from 'next/router' import { useEffect, useState } from 'react' import { NavbarState, useNavbarState } from '../../states/navbarState' +import { lsdUtils } from '../../utils/lsd.utils' import { LogosIcon } from '../Icons/LogosIcon' -import { SocialMediaKit } from '@/components/NavBar/Navbar.SocialMediaKit' export interface NavBarProps { defaultState?: Partial @@ -42,6 +44,37 @@ export default function NavBar({ defaultState }: NavBarProps) { defaultState && state.state.set((value) => ({ ...value, ...defaultState })) }, [defaultState]) + const buttons = ( + <> + + + + + + + + + + + + + + + + + {showMobileMenu ? ( + + ) : ( + + )} + + + + ) + return ( - - - - - - - - -
- - - -
+ {buttons}
{showMobileMenu && } @@ -108,8 +126,8 @@ const Container = styled.header<{ } ` -const Buttons = styled.div` - display: flex; +const Buttons = styled.div<{ mobile?: boolean }>` + display: none; align-items: center; justify-content: center; @@ -120,6 +138,14 @@ const Buttons = styled.div` margin-left: -1px; } } + + ${(props) => lsdUtils.breakpoint(props.theme, 'xs', 'exact')} { + ${(props) => props.mobile && `display: flex;`} + } + + ${(props) => lsdUtils.breakpoint(props.theme, 'sm', 'up')} { + ${(props) => !props.mobile && `display: flex;`} + } ` const NavBarContainer = styled.nav` display: flex;