Skip to content

Commit

Permalink
chore: redo examples page
Browse files Browse the repository at this point in the history
  • Loading branch information
joshuaellis committed May 26, 2024
1 parent a3b84e7 commit 5608fbe
Show file tree
Hide file tree
Showing 11 changed files with 852 additions and 137 deletions.
2 changes: 1 addition & 1 deletion docs/app/components/Buttons/NavButton.css.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export const navAnchor = recipe({
variants: {
active: {
true: {
background: '$redYellowGradient100',
background: vars.colors.redYellowGradient100,
},
false: {
backgroundColor: '$white',
Expand Down
12 changes: 12 additions & 0 deletions docs/app/components/Header/Header.css.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export const desktopHeight = createVar()
export const header = style({
width: '100%',
paddingTop: vars.space['15'],
paddingBottom: vars.space['15'],
zIndex: vars.zIndices['1'],

'@media': {
Expand All @@ -19,6 +20,17 @@ export const header = style({

[`screen and ${BREAKPOINTS.tabletUp}`]: {
paddingTop: vars.space['25'],
paddingBottom: vars.space['25'],
},
},
})

export const headerSpacing = style({
height: mobileHeight,

'@media': {
[`screen and ${BREAKPOINTS.tabletUp}`]: {
height: desktopHeight,
},
},
})
Expand Down
86 changes: 50 additions & 36 deletions docs/app/components/Header/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import {
headerScrolledDown,
headerTransparentBackground,
headerAddMarginToMain,
headerSpacing,
} from './Header.css'
import clsx from 'clsx'

Expand All @@ -43,7 +44,7 @@ interface HeaderProps {
}

export const getHeaderHeights = (): [desktop: number, mobile: number] => [
89, 63,
114, 78,
]

export const Header = ({
Expand Down Expand Up @@ -72,41 +73,54 @@ export const Header = ({
const [desktopHeight, mobileHeight] = headerHeights

return (
<animated.header
className={clsx(
header,
isStuck && headerStuck,
(subnav.length > 0 || (scrollTop > 20 && direction === 'up')) &&
headerScrolledDown,
transparentBackground && headerTransparentBackground,
addMarginToMain && headerAddMarginToMain,
className
<>
{isStuck && (
<div
className={headerSpacing}
style={{
...assignInlineVars({
[mobileHeightVar]: `${mobileHeight}px`,
[desktopHeightVar]: `${desktopHeight}px`,
}),
}}
/>
)}
style={{
...styles,
position,
...assignInlineVars({
[mobileHeightVar]: `${mobileHeight}px`,
[desktopHeightVar]: `${desktopHeight}px`,
}),
}}
>
<div className={flexContainer}>
<HeaderNavigation className={desktopNavigation} />
<Dialog.Root open={dialogOpen} onOpenChange={handleDialogChange}>
<Dialog.Trigger className={mobileMenuButton}>
<List className={hamburgerMenu} size={20} />
</Dialog.Trigger>
<Dialog.Portal forceMount>
<HeaderSidePanel
onNavigationClick={handleNavigationClick}
isOpen={dialogOpen}
submenu={sidebar}
/>
</Dialog.Portal>
</Dialog.Root>
<Logo />
</div>
</animated.header>
<animated.header
className={clsx(
header,
isStuck && headerStuck,
(subnav.length > 0 || (scrollTop > 20 && direction === 'up')) &&
headerScrolledDown,
transparentBackground && headerTransparentBackground,
addMarginToMain && headerAddMarginToMain,
className
)}
style={{
...styles,
position,
...assignInlineVars({
[mobileHeightVar]: `${mobileHeight}px`,
[desktopHeightVar]: `${desktopHeight}px`,
}),
}}
>
<div className={flexContainer}>
<HeaderNavigation className={desktopNavigation} />
<Dialog.Root open={dialogOpen} onOpenChange={handleDialogChange}>
<Dialog.Trigger className={mobileMenuButton}>
<List className={hamburgerMenu} size={20} />
</Dialog.Trigger>
<Dialog.Portal forceMount>
<HeaderSidePanel
onNavigationClick={handleNavigationClick}
isOpen={dialogOpen}
submenu={sidebar}
/>
</Dialog.Portal>
</Dialog.Root>
<Logo />
</div>
</animated.header>
</>
)
}
83 changes: 83 additions & 0 deletions docs/app/components/Select.css.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
import { style } from '@vanilla-extract/css'
import { vars } from '../styles/theme-contract.css'
import { BREAKPOINTS } from '../styles/breakpoints.css'
import { darkThemeClass } from '../styles/dark-theme.css'
import { recipe } from '@vanilla-extract/recipes'

export const controlDiv = recipe({
base: {
background: 'transparent',
fontWeight: vars.fontWeights.default,
cursor: 'pointer',
},
variants: {
isFocused: {
true: {
borderBottom: `solid 2px ${vars.colors.red100}`,
},
false: {
borderBottom: `solid 2px ${vars.colors.black}`,
},
},
},
})

export const placeholderSpan = style({
fontSize: vars.fontSizes.XXS,
lineHeight: vars.lineHeights.XXS,

'@media': {
[`screen and ${BREAKPOINTS.tabletUp}`]: {
fontSize: vars.fontSizes.XS,
lineHeight: vars.lineHeights.XS,
},
},
})

export const menuBackground = style({
backgroundColor: vars.colors.white,
opacity: 0.2,
position: 'absolute',
inset: 0,
zIndex: vars.zIndices['1'],
})

export const menu = style({
position: 'absolute',
zIndex: vars.zIndices['2'],
background: vars.colors.codeBackground,
color: vars.colors.black,
fontSize: vars.fontSizes.XXS,
lineHeight: vars.lineHeights.XXS,
overflow: 'hidden',
boxShadow:
'rgba(27,31,36,0.12) 0px 1px 3px, rgba(66,74,83,0.12) 0px 8px 24px',
width: '100%',
borderTopRightRadius: vars.radii.r8,
borderTopLeftRadius: vars.radii.r8,
bottom: 0,
left: 0,

[`${darkThemeClass} &`]: {
boxShadow:
'rgba(27,31,36,0.5) 0px 1px 3px, rgba(18 21 23 / 40%) 0px 8px 24px',
},

'@media': {
[`screen and ${BREAKPOINTS.tabletUp}`]: {
bottom: 'unset',
borderRadius: vars.radii.r8,
width: 200,
fontSize: vars.fontSizes.XS,
lineHeight: vars.lineHeights.XS,
},
},
})

export const option = style({
cursor: 'pointer',
display: 'flex',
justifyContent: 'space-between',
alignItems: 'center',
padding: `${vars.space['10']} ${vars.space['40']} ${vars.space['10']} ${vars.space['20']}`,
})
Loading

0 comments on commit 5608fbe

Please sign in to comment.