fix: mobile navbar border and links spacing

This commit is contained in:
Hossein Mehrabi 2023-08-28 15:43:45 +03:30
parent a4275bd0c6
commit 33d2a3593d
No known key found for this signature in database
GPG Key ID: 45C04964191AFAA1
2 changed files with 34 additions and 18 deletions

View File

@ -13,6 +13,7 @@ import {
SearchIcon, SearchIcon,
Typography, Typography,
} from '@acid-info/lsd-react' } from '@acid-info/lsd-react'
import { css } from '@emotion/react'
import styled from '@emotion/styled' import styled from '@emotion/styled'
import Link from 'next/link' import Link from 'next/link'
import { useRouter } from 'next/router' import { useRouter } from 'next/router'
@ -78,18 +79,17 @@ export default function NavBar({ defaultState }: NavBarProps) {
) )
return ( return (
<Container <Container className={`${hide ? 'hide' : ''} ${className}`}>
bordered={state.showTitle.get()} <NavBarContainer bordered={state.showTitle.get()}>
className={`${hide ? 'hide' : ''} ${className}`}
>
<NavBarContainer>
<LeftContainer href={'/'}> <LeftContainer href={'/'}>
<LogosIcon color="primary" /> <LogosIcon color="primary" />
{state.showTitle.get() && ( <PressLogoType
<PressLogoType variant={'h6'} genericFontFamily={'serif'}> variant={'h6'}
{state.title.get()} genericFontFamily={'serif'}
</PressLogoType> display={state.showTitle.get() || showMobileMenu}
)} >
{state.title.get()}
</PressLogoType>
</LeftContainer> </LeftContainer>
<NavLinksContainer> <NavLinksContainer>
<NavbarLinks links={NavLinksItems} /> <NavbarLinks links={NavLinksItems} />
@ -104,7 +104,14 @@ export default function NavBar({ defaultState }: NavBarProps) {
) )
} }
const PressLogoType = styled(Typography)`` const PressLogoType = styled(Typography)<{ display: boolean }>`
${(props) =>
!props.display &&
css`
opacity: 0;
visibility: hidden;
`}
`
const Container = styled.header<{ const Container = styled.header<{
bordered?: boolean bordered?: boolean
@ -120,9 +127,6 @@ const Container = styled.header<{
background: rgb(var(--lsd-surface-primary)); background: rgb(var(--lsd-surface-primary));
transition: top 0.2s; transition: top 0.2s;
border-bottom: ${(props) => (props.bordered ? '1px' : '0px')} solid
rgb(var(--lsd-theme-primary));
&.article_page, &.article_page,
&.search_page { &.search_page {
} }
@ -149,12 +153,17 @@ const Buttons = styled.div<{ mobile?: boolean }>`
${(props) => !props.mobile && `display: flex;`} ${(props) => !props.mobile && `display: flex;`}
} }
` `
const NavBarContainer = styled.nav` const NavBarContainer = styled.nav<{
bordered?: boolean
}>`
display: flex; display: flex;
padding: 16px 0; padding: 16px 0;
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
position: relative; position: relative;
height: 100%;
border-bottom: ${(props) => (props.bordered ? '1px' : '0px')} solid
rgb(var(--lsd-theme-primary));
margin: auto; margin: auto;
@ -171,6 +180,10 @@ const NavBarContainer = styled.nav`
style { style {
display: none !important; display: none !important;
} }
${(props) => lsdUtils.breakpoint(props.theme, 'xs', 'exact')} {
border-bottom: 1px solid rgb(var(--lsd-theme-primary));
}
` `
const NavLinksContainer = styled.div` const NavLinksContainer = styled.div`

View File

@ -60,12 +60,15 @@ const Container = styled.div`
flex-direction: column; flex-direction: column;
align-items: flex-start; align-items: flex-start;
justify-content: flex-start; justify-content: flex-start;
padding-top: 32px; padding-top: 0;
padding-bottom: 16px; padding-bottom: 16px;
border-top: 1px solid rgb(var(--lsd-theme-primary)); gap: 0;
gap: 28px;
height: 100%; height: 100%;
> label {
padding: 14px 0;
}
.divider { .divider {
display: none; display: none;
} }