Skip to content

Commit

Permalink
clean up inline tab styles
Browse files Browse the repository at this point in the history
  • Loading branch information
jordanlesich committed Aug 15, 2023
1 parent 54b60fe commit e9ffabd
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 25 deletions.
7 changes: 4 additions & 3 deletions apps/web/src/modules/auction/components/ViewSwitcher.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@ import { Button, Flex, Text } from '@zoralabs/zord'
import React, { ReactNode } from 'react'

import {
buttonTab,
newTag,
selectedTab,
unselectedTab,
} from 'src/modules/dao/components/AuctionChart/AuctionChart.css'
import { TopSectionView } from 'src/modules/dao/components/DaoTopSection'

Expand All @@ -31,7 +30,9 @@ export const ViewSwitcher = ({
px={'x0'}
mr={'x3'}
onClick={() => setTopSectionView(view)}
className={view === topSectionView ? selectedTab : unselectedTab}
className={
view === topSectionView ? buttonTab['selected'] : buttonTab['unselected']
}
>
{view}
{view === 'chart' && (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,32 @@
import { style } from '@vanilla-extract/css'
import { style, styleVariants } from '@vanilla-extract/css'

import { skeletonAnimation } from 'src/styles/animations.css'

export const selectedTab = style({
borderBottom: '2px solid black',
borderBottomLeftRadius: '0px',
borderBottomRightRadius: '0px',
const tabBase = style({
textTransform: 'capitalize',
width: 'fit-content',
})
export const unselectedTab = style({
borderBottom: '2px solid transparent',
borderBottomLeftRadius: '0px',
borderBottomRightRadius: '0px',
textTransform: 'capitalize',
width: 'fit-content',
})
const selected = style({
borderBottom: '2px solid black',
})
const unselected = style({
borderBottom: '2px solid transparent',
})
const inner = style({
fontSize: '14px',
fontWeight: 500,
height: 'fit-content',
})

export const buttonTab = styleVariants({
selected: [tabBase, selected],
unselected: [tabBase, unselected],
innerSelected: [tabBase, selected, inner],
innerUnselected: [tabBase, unselected, inner],
})

export const chartSkeleton = style({
animation: skeletonAnimation,
height: '330px',
Expand Down
17 changes: 5 additions & 12 deletions apps/web/src/modules/dao/components/AuctionChart/Layouts.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,18 @@ import dayjs from 'dayjs'
import relativeTime from 'dayjs/plugin/relativeTime'
import React, { ReactNode, useMemo } from 'react'


import { AuctionHistory, StartTimes } from './AuctionChart'
import {
buttonTab,
chartSkeleton,
displayPanelBox,
innerBox,
outerBox,
selectedTab,
unselectedTab,
viewBox,
} from './AuctionChart.css'

export const AuctionGraphLayout = ({
chart,
viewSwitcher,
startTime,
setStartTime,
chartData,
Expand Down Expand Up @@ -67,16 +64,12 @@ export const AuctionGraphLayout = ({
px={'x0'}
py={'x2'}
height={'x1'}
mr={'x6'}
className={isActive ? selectedTab : unselectedTab}
ml={{ '@initial': 'x4', '@768': 'x6' }}
className={
isActive ? buttonTab['innerSelected'] : buttonTab['innerUnselected']
}
onClick={() => setStartTime(value)}
// using md and inline to override the default width properties from zord
size="md"
style={{
fontSize: '14px',
fontWeight: 500,
height: 'fit-content',
}}
>
{label}
</Button>
Expand Down

0 comments on commit e9ffabd

Please sign in to comment.