Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

responsive NavBar #29

Merged
merged 1 commit into from
Dec 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions frontend/src/components/Layout/App/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import NavBar from 'src/components/NavBar'
import NavBarMobile from 'src/components/NavBar/Mobile'
import Box from 'src/theme/components/Box'

import * as styles from './style.css'
Expand All @@ -11,6 +12,7 @@ export default function AppLayout({ children }: AppLayoutProps) {
return (
<>
<NavBar />
<NavBarMobile />
<Box as="span" className={styles.radial} />
{children}
</>
Expand Down
21 changes: 21 additions & 0 deletions frontend/src/components/NavBar/Mobile/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { NavLink } from 'react-router-dom'
import Box from 'src/theme/components/Box'
import { Row } from 'src/theme/components/Flex'
import * as Text from 'src/theme/components/Text'

import { links } from '..'
import * as styles from './style.css'

export default function NavBarMobile() {
return (
<Box className={styles.navBarContainer}>
<Row justifyContent="space-around">
{links.map(({ name, path }) => (
<NavLink key={path} to={path} className={({ isActive }) => styles.navLink({ active: isActive })}>
<Text.Body>{name}</Text.Body>
</NavLink>
))}
</Row>
</Box>
)
}
47 changes: 47 additions & 0 deletions frontend/src/components/NavBar/Mobile/style.css.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import { style } from '@vanilla-extract/css'
import { recipe } from '@vanilla-extract/recipes'
import { sprinkles } from 'src/theme/css/sprinkles.css'

export const navBarContainer = style([
{
borderTopLeftRadius: '16px',
borderTopRightRadius: '16px',
},
sprinkles({
background: 'bg2',
position: 'fixed',
bottom: '0',
left: '0',
right: '0',
paddingX: '8',
paddingBottom: '18',
paddingTop: '16',
borderColor: 'border1',
borderTopWidth: '1px',
borderStyle: 'solid',
display: {
md: 'none',
},
}),
])

export const navLink = recipe({
base: [
sprinkles({
paddingX: '12',
paddingY: '8',
borderRadius: '10',
}),
],

variants: {
active: {
true: sprinkles({ background: 'bg3' }),
false: {},
},
},

defaultVariants: {
active: false,
},
})
27 changes: 18 additions & 9 deletions frontend/src/components/NavBar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,17 @@ import * as Text from 'src/theme/components/Text'
import Web3Status from '../Web3Status'
import * as styles from './style.css'

export const links = [
{
name: 'Launch',
path: '/launch',
},
{
name: 'Manager',
path: '/manage',
},
]

export default function NavBar() {
const navigate = useNavigate()

Expand All @@ -22,15 +33,13 @@ export default function NavBar() {
/>
</Box>

<Row gap="12">
<Link to="/launch">
<Text.Body className={styles.navLink}>Launch</Text.Body>
</Link>

<Link to="/manage">
<Text.Body className={styles.navLink}>Manage</Text.Body>
</Link>
</Row>
<Box className={styles.navLinksContainer}>
{links.map(({ name, path }) => (
<Link key={path} to={path}>
<Text.Body className={styles.navLink}>{name}</Text.Body>
</Link>
))}
</Box>
</Row>

<Box>
Expand Down
8 changes: 8 additions & 0 deletions frontend/src/components/NavBar/style.css.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,14 @@ export const logoContainer = style([
}),
])

export const navLinksContainer = sprinkles({
gap: '12',
display: {
sm: 'none',
md: 'flex',
},
})

export const navLink = sprinkles({
fontWeight: 'medium',
fontSize: '18',
Expand Down
Loading