Skip to content

Commit f378b9d

Browse files
committed
feat(v3-uplift): sort chevron, tertiary button, tooltip & toggle-group restyle
- lists: replace the sort-column CSS triangles with an up/down chevron (fg-icon token via currentColor) - theme: add a `tertiary` Button variant (the secondary pill minus its ring/shadow) and point the dashboard Claim button at it - tooltip: bg-5 surface (from bgp-4) - toggle group: restyle the shell (bg-5 light / bg-2 dark, frameless in light, shadow-low frame in dark), concentric per-mode pill radius, fg-max labels with light-mode opacity states, and an animated hover - toggles: label variant buttonM -> h5 across the type selectors - refactor (simplify pass): export a shared `darkScheme` helper instead of re-declaring it; hoist activeFill/dimmedInactive toggle recipes; DRY the chevron paths
1 parent 5112fe7 commit f378b9d

13 files changed

Lines changed: 145 additions & 82 deletions

File tree

src/components/ContentWithTooltip.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ interface ContentWithTooltipProps {
1515

1616
export const PopperComponent = styled(Popper)(({ theme }) =>
1717
theme.unstable_sx({
18-
// Solid bgp-4 tooltip surface (bgp-4 = #f2f2f2 light / #1E1E20 dark), framed by an inset
19-
// border-0 hairline + a soft shadow-medium drop. Padding lives here (not the inner Box).
18+
// Solid bg-5 tooltip surface, framed by an inset border-0 hairline + a soft shadow-medium
19+
// drop. Padding lives here (not the inner Box).
2020
'.MuiTooltip-tooltip': {
2121
color: 'fg-1',
22-
backgroundColor: 'bgp-4',
22+
backgroundColor: 'bg-5',
2323
borderRadius: '0.5rem',
2424
boxShadow: `0 1px 12px 0 ${figVars['shadow-medium']}, inset 0 0 0 1px ${figVars['border-0']}`,
2525
padding: '0.88rem',
@@ -32,7 +32,7 @@ export const PopperComponent = styled(Popper)(({ theme }) =>
3232
lineHeight: '135%',
3333
},
3434
'.MuiTooltip-arrow': {
35-
color: 'bgp-4',
35+
color: 'bg-5',
3636
},
3737
})
3838
);

src/components/StyledToggleButton.tsx

Lines changed: 35 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,53 @@
11
import { styled, ToggleButton, ToggleButtonProps } from '@mui/material';
2-
import React from 'react';
32
import { figVars } from 'src/utils/figmaColors';
3+
import { darkScheme } from 'src/utils/theme';
4+
5+
// Dimmed inactive label: fg-max at 0.3 opacity in light, full opacity in dark. Shared by the
6+
// resting state and the disabled-not-selected state (which must re-assert it over MUI's default).
7+
const dimmedInactive = {
8+
color: figVars['fg-max'],
9+
opacity: 0.3,
10+
...darkScheme({ opacity: 1 }),
11+
};
12+
13+
// Active pill: a bg-max fill with a border-1 ring in light; a bg-5 fill and no ring in dark, fg-max
14+
// label at full opacity. Shared by Mui-selected/focus and disabled-selected (some consumers disable
15+
// the active tab).
16+
const activeFill = {
17+
opacity: 1,
18+
color: figVars['fg-max'],
19+
backgroundColor: figVars['bg-max'],
20+
boxShadow: `inset 0 0 0 1px ${figVars['border-1']}`,
21+
...darkScheme({
22+
backgroundColor: figVars['bg-5'],
23+
boxShadow: 'none',
24+
}),
25+
};
426

527
const CustomTxModalToggleButton = styled(ToggleButton)<ToggleButtonProps>({
628
border: 0,
729
flex: 1,
830
height: '100%',
9-
color: figVars['fg-3'],
31+
// Label typography (H5) is owned by each consumer's <Typography variant="h5">.
32+
...dimmedInactive,
1033

11-
// Inactive hover: brighten the label only (fg-3 → fg-2), never a background.
34+
// Inactive hover: nudge the opacity up in light; unchanged in dark. Never a background.
1235
'&:hover': {
1336
backgroundColor: 'transparent',
14-
color: figVars['fg-2'],
37+
opacity: 0.5,
38+
...darkScheme({ opacity: 1 }),
1539
},
1640

17-
// Active — and keyboard focus (Mui-focusVisible): a solid fill one step darker than the
18-
// `bg-1` track (no shadow; the group carries the only ring) with primary text.
19-
'&.Mui-selected, &.Mui-selected:hover, &.Mui-focusVisible': {
20-
backgroundColor: figVars['bg-4'],
21-
color: figVars['fg-1'],
22-
},
41+
'&.Mui-selected, &.Mui-focusVisible': activeFill,
2342

24-
// Disabled but NOT selected: muted, still readable.
25-
'&.Mui-disabled:not(.Mui-selected)': {
26-
color: figVars['fg-3'],
27-
opacity: 0.5,
43+
// Active hover: step the fill one shade (bg-max → bg-1 light, bg-5 → bg-6 dark); the ring persists.
44+
'&.Mui-selected:hover': {
45+
backgroundColor: figVars['bg-1'],
46+
...darkScheme({ backgroundColor: figVars['bg-6'] }),
2847
},
2948

30-
// Disabled + selected: preserve the selected look (some consumers disable the active tab).
31-
'&.Mui-disabled.Mui-selected': {
32-
backgroundColor: figVars['bg-4'],
33-
color: figVars['fg-1'],
34-
opacity: 1,
35-
},
49+
'&.Mui-disabled:not(.Mui-selected)': dimmedInactive,
50+
'&.Mui-disabled.Mui-selected': activeFill,
3651
}) as typeof ToggleButton;
3752

3853
export function StyledTxModalToggleButton(props: ToggleButtonProps) {

src/components/StyledToggleButtonGroup.tsx

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,38 @@
11
import { styled, ToggleButtonGroup, ToggleButtonGroupProps } from '@mui/material';
2-
import { figVars } from 'src/utils/figmaColors';
2+
import { figSurfaceShadow, figVars } from 'src/utils/figmaColors';
3+
import { darkScheme } from 'src/utils/theme';
34

4-
// Segmented control framed like a medium outlined button: a `bg-5` fill with an inset 1px hairline
5-
// (shadow-stroke-2) as the ONLY frame — no border. 36px tall / 0.5rem radius to match the medium
6-
// button; the active pill stays concentric (0.375rem) inside the 2px inset.
5+
// Segmented-control shell: a bg-5 (light) / bg-2 (dark) fill. Light is frameless with a tight
6+
// 0.06rem inset; dark adds the shared surface shadow (shadow-low drop + 1px ring) and a 0.13rem
7+
// inset. 0.5625rem radius; the pill radius tracks the inset so the corners stay concentric.
78
const CustomTxModalToggleGroup = styled(ToggleButtonGroup)<ToggleButtonGroupProps>({
89
backgroundColor: figVars['bg-5'],
9-
borderRadius: '0.5rem',
10-
boxShadow: `inset 0 0 0 1px ${figVars['shadow-stroke-2']}`,
11-
padding: '2px',
10+
boxShadow: 'none',
11+
padding: '0.06rem',
12+
...darkScheme({
13+
backgroundColor: figVars['bg-2'],
14+
boxShadow: figSurfaceShadow(),
15+
padding: '0.13rem',
16+
}),
17+
borderRadius: '0.5625rem',
1218
height: '36px',
1319
width: '100%',
14-
// Strip MUI's per-segment border (its ToggleButton root has a 1px divider border — the stray
15-
// outline on the active pill), negative margins, and merged first/last corner radii so each
16-
// segment is an independent borderless pill and the group carries the only ring.
20+
// Strip MUI's per-segment border + overlap margins so each segment is an independent borderless
21+
// pill (the group carries the only frame). Pill radius = shell radius − inset gap, per mode:
22+
// 0.5025rem (0.5625 − 0.06) in light, 0.4325rem (0.5625 − 0.13) in dark.
1723
'& .MuiToggleButtonGroup-grouped': {
24+
'--toggle-pill-radius': '0.5025rem',
25+
...darkScheme({ '--toggle-pill-radius': '0.4325rem' }),
1826
margin: 0,
1927
border: 0,
20-
borderRadius: '0.375rem',
28+
borderRadius: 'var(--toggle-pill-radius)',
2129
'&:not(:first-of-type)': {
2230
marginLeft: 0,
2331
borderLeft: 0,
24-
borderRadius: '0.375rem',
32+
borderRadius: 'var(--toggle-pill-radius)',
2533
},
2634
'&:not(:last-of-type)': {
27-
borderRadius: '0.375rem',
35+
borderRadius: 'var(--toggle-pill-radius)',
2836
},
2937
},
3038
}) as typeof ToggleButtonGroup;

src/components/lists/ListHeaderTitle.tsx

Lines changed: 18 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { Box, Typography } from '@mui/material';
22
import { ReactNode } from 'react';
33
import { useRootStore } from 'src/store/root';
4-
import { figVars } from 'src/utils/figmaColors';
54

65
import { MARKETS } from '../../utils/events';
76

@@ -54,32 +53,24 @@ export const ListHeaderTitle = ({
5453
{children}
5554

5655
{!!sortKey && (
57-
<Box sx={{ display: 'inline-flex', flexDirection: 'column', ml: 1 }}>
58-
<Box
59-
component="span"
60-
sx={{
61-
width: 0,
62-
height: 0,
63-
borderStyle: 'solid',
64-
borderWidth: '0 4px 4px 4px',
65-
borderColor: `transparent transparent ${
66-
sortName === sortKey && sortDesc ? figVars['fg-2'] : figVars['border-2']
67-
} transparent`,
68-
mb: 0.5,
69-
}}
70-
/>
71-
<Box
72-
component="span"
73-
sx={{
74-
width: 0,
75-
height: 0,
76-
borderStyle: 'solid',
77-
borderWidth: '4px 4px 0 4px',
78-
borderColor: `${
79-
sortName === sortKey && !sortDesc ? figVars['fg-2'] : figVars['border-2']
80-
} transparent transparent transparent`,
81-
}}
82-
/>
56+
<Box sx={{ display: 'inline-flex', flexShrink: 0, ml: 1, color: 'fg-icon' }}>
57+
{/* Static sortable indicator: an up/down chevron. Color comes from the fg-icon token via
58+
currentColor on the Box — the P3-safe way to tint an SVG, since var() doesn't resolve
59+
in SVG presentation attributes. stroke/width/caps are inherited by both paths. */}
60+
<svg
61+
width="8"
62+
height="10"
63+
viewBox="0 0 8 10"
64+
fill="none"
65+
stroke="currentColor"
66+
strokeWidth="1.5"
67+
strokeLinecap="round"
68+
strokeLinejoin="round"
69+
xmlns="http://www.w3.org/2000/svg"
70+
>
71+
<path d="M1.59961 3L3.99961 1L6.39961 3" />
72+
<path d="M1.59961 7L3.99961 9L6.39961 7" />
73+
</svg>
8374
</Box>
8475
)}
8576
</Typography>

src/components/transactions/GovDelegation/DelegationTypeSelector.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export const DelegationTypeSelector = ({
2828
value={DelegationType.ALL}
2929
disabled={delegationType === DelegationType.ALL}
3030
>
31-
<Typography variant="buttonM">
31+
<Typography variant="h5">
3232
<Trans>Both</Trans>
3333
</Typography>
3434
</StyledTxModalToggleButton>
@@ -37,7 +37,7 @@ export const DelegationTypeSelector = ({
3737
value={DelegationType.VOTING}
3838
disabled={delegationType === DelegationType.VOTING}
3939
>
40-
<Typography variant="buttonM">
40+
<Typography variant="h5">
4141
<Trans>Voting</Trans>
4242
</Typography>
4343
</StyledTxModalToggleButton>
@@ -46,7 +46,7 @@ export const DelegationTypeSelector = ({
4646
value={DelegationType.PROPOSITION}
4747
disabled={delegationType === DelegationType.PROPOSITION}
4848
>
49-
<Typography variant="buttonM">
49+
<Typography variant="h5">
5050
<Trans>Proposition</Trans>
5151
</Typography>
5252
</StyledTxModalToggleButton>

src/components/transactions/Repay/RepayTypeSelector.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export function RepayTypeSelector({
3939
disabled={repayType === RepayType.BALANCE}
4040
onClick={() => trackEvent(REPAY_MODAL.SWITCH_REPAY_TYPE, { repayType: 'Wallet Balance' })}
4141
>
42-
<Typography variant="buttonM">
42+
<Typography variant="h5">
4343
<Trans>Wallet balance</Trans>
4444
</Typography>
4545
</StyledTxModalToggleButton>
@@ -49,7 +49,7 @@ export function RepayTypeSelector({
4949
disabled={repayType === RepayType.COLLATERAL}
5050
onClick={() => trackEvent(REPAY_MODAL.SWITCH_REPAY_TYPE, { repayType: 'Collateral' })}
5151
>
52-
<Typography variant="buttonM">
52+
<Typography variant="h5">
5353
<Trans>Collateral</Trans>
5454
</Typography>
5555
</StyledTxModalToggleButton>

src/components/transactions/Swap/shared/OrderTypeSelector.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export function OrderTypeSelector({
2626
value={OrderType.MARKET}
2727
disabled={switchType === OrderType.MARKET}
2828
>
29-
<Typography variant="buttonM">
29+
<Typography variant="h5">
3030
<Trans>Market</Trans>
3131
</Typography>
3232
</StyledTxModalToggleButton>
@@ -35,7 +35,7 @@ export function OrderTypeSelector({
3535
value={OrderType.LIMIT}
3636
disabled={switchType === OrderType.LIMIT || limitsOrderButtonBlocked}
3737
>
38-
<Typography variant="buttonM">
38+
<Typography variant="h5">
3939
<Trans>Limit</Trans>
4040
</Typography>
4141
</StyledTxModalToggleButton>

src/components/transactions/Withdraw/WithdrawTypeSelector.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export function WithdrawTypeSelector({
3737
trackEvent(WITHDRAW_MODAL.SWITCH_WITHDRAW_TYPE, { withdrawType: 'Withdraw' })
3838
}
3939
>
40-
<Typography variant="buttonM">
40+
<Typography variant="h5">
4141
<Trans>Withdraw</Trans>
4242
</Typography>
4343
</StyledTxModalToggleButton>
@@ -49,7 +49,7 @@ export function WithdrawTypeSelector({
4949
trackEvent(WITHDRAW_MODAL.SWITCH_WITHDRAW_TYPE, { withdrawType: 'Withdraw and Swap' })
5050
}
5151
>
52-
<Typography variant="buttonM">
52+
<Typography variant="h5">
5353
<Trans>Withdraw & Swap</Trans>
5454
</Typography>
5555
</StyledTxModalToggleButton>

src/modules/dashboard/DashboardTopPanel.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ export const DashboardTopPanel = () => {
257257
</Box>
258258

259259
<Button
260-
variant="outlined"
260+
variant="tertiary"
261261
size="small"
262262
onClick={() => openClaimRewards()}
263263
sx={{ minWidth: 'unset', ml: { xs: 0, xsm: 2 } }}

src/modules/dev/ComponentShowcase/components/TogglesBadgesSection/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ const ToggleDemo = ({ options, initial }: { options: ToggleOption[]; initial: st
1919
<StyledTxModalToggleGroup value={value} exclusive onChange={(_, v) => v && setValue(v)}>
2020
{options.map((o) => (
2121
<StyledTxModalToggleButton key={o.value} value={o.value} disabled={o.disabled}>
22-
<Typography variant="buttonM">{o.label}</Typography>
22+
<Typography variant="h5">{o.label}</Typography>
2323
</StyledTxModalToggleButton>
2424
))}
2525
</StyledTxModalToggleGroup>

0 commit comments

Comments
 (0)