Skip to content

Commit

Permalink
[frontend] Fully responsive (#39)
Browse files Browse the repository at this point in the history
Fixes #34 

From this point we should only push responsive style

---------

Co-authored-by: Abdel @ StarkWare <[email protected]>
  • Loading branch information
0xChqrles and AbdelStark authored Dec 13, 2023
1 parent 5e66bd8 commit de2fd3a
Show file tree
Hide file tree
Showing 8 changed files with 67 additions and 19 deletions.
1 change: 1 addition & 0 deletions frontend/src/components/NavBar/Mobile/style.css.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export const navBarContainer = style([
display: {
md: 'none',
},
zIndex: 'sticky',
}),
])

Expand Down
16 changes: 15 additions & 1 deletion frontend/src/components/NavBar/index.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { useEffect, useState } from 'react'
import { Link, useNavigate } from 'react-router-dom'
import Box from 'src/theme/components/Box'
import { Row } from 'src/theme/components/Flex'
Expand All @@ -23,10 +24,23 @@ export const links = [
]

export default function NavBar() {
// state
const [scrolledOnTop, setScrolledOnTop] = useState(true)

const navigate = useNavigate()

useEffect(() => {
const scrollListener = () => {
setScrolledOnTop(!window.scrollY)
}

window.addEventListener('scroll', scrollListener)

return () => window.removeEventListener('scroll', scrollListener)
}, [])

return (
<Box as="nav" className={styles.nav}>
<Box as="nav" className={styles.nav({ onTop: scrolledOnTop })}>
<Row justifyContent="space-between">
<Row gap="24">
<Box className={styles.logoContainer}>
Expand Down
39 changes: 31 additions & 8 deletions frontend/src/components/NavBar/style.css.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,37 @@
import { style } from '@vanilla-extract/css'
import { recipe } from '@vanilla-extract/recipes'
import { sprinkles } from 'src/theme/css/sprinkles.css'

export const nav = style([
sprinkles({
position: 'sticky',
top: '0',
padding: '24',
zIndex: 'sticky',
}),
])
export const nav = recipe({
base: [
sprinkles({
position: 'sticky',
top: '0',
padding: '24',
zIndex: 'sticky',
transition: '125',
}),
],

variants: {
onTop: {
true: {},
false: [
sprinkles({
background: 'bg2',
borderWidth: '0px',
borderBottomWidth: '1px',
borderColor: 'border1',
borderStyle: 'solid',
}),
],
},
},

defaultVariants: {
onTop: true,
},
})

export const logoContainer = style([
{
Expand Down
8 changes: 6 additions & 2 deletions frontend/src/pages/Home/style.css.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,18 @@ import { transparentize } from 'polished'
import { sprinkles, vars } from 'src/theme/css/sprinkles.css'

export const container = style([
{
sprinkles({
display: 'flex',
flexDirection: 'column',
alignItems: 'center',
justifyContent: 'center',
textAlign: 'center',
overflow: 'auto',
},
paddingBottom: {
sm: '88',
md: '32',
},
}),
])

export const backgroundContainer = style([
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/pages/Launch/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ export default function LaunchPage() {
<div />

<PrimaryButton disabled={!account} className={styles.deployButton}>
{account ? 'DEPLOY' : 'CONNECT WALLET'}
{account ? 'Deploy' : 'Connect wallet'}
</PrimaryButton>
</Column>
</Box>
Expand Down
14 changes: 10 additions & 4 deletions frontend/src/pages/Launch/style.css.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,18 @@ import { style } from '@vanilla-extract/css'
import { sprinkles } from 'src/theme/css/sprinkles.css'

export const wrapper = style([
{
padding: '68px 0px',
},
sprinkles({
width: 'full',
justifyContent: 'center',
paddingX: '12',
paddingTop: {
sm: '20',
md: '64',
},
paddingBottom: {
sm: '88',
md: '32',
},
}),
])

Expand All @@ -31,7 +37,7 @@ export const deployButton = style([
},
sprinkles({
fontSize: '24',
fontWeight: 'bold',
fontWeight: 'semibold',
}),
])

Expand Down
3 changes: 1 addition & 2 deletions frontend/src/theme/css/global.css.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,12 @@ import { vars } from './sprinkles.css'

globalStyle('*', {
fontFamily: "'Inter', sans-serif",
boxSizing: 'border-box',
})

globalStyle('html, body', {
margin: 0,
padding: 0,
height: '100vh',
overflow: 'hidden',
})

globalStyle('html', {
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/theme/css/sprinkles.css.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ const spacing = {
'32': '32px',
'42': '42px',
'64': '64px',
'88': '88px',
'128': '128px',
'256': '256px',
'1/2': '50%',
Expand Down Expand Up @@ -261,11 +262,11 @@ const layoutStyles = defineProperties({
minWidth: dimensions,
maxHeight: dimensions,
minHeight: dimensions,
padding: spacing,
paddingBottom: spacing,
paddingLeft: spacing,
paddingRight: spacing,
paddingTop: spacing,
padding: spacing,
bottom: spacing,
left: spacing,
right: spacing,
Expand Down

0 comments on commit de2fd3a

Please sign in to comment.