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

upcoming: [M3-8772] - Add global borderRadiusTokens to theme and replace hardcoded values #11169

Merged
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@linode/manager": Upcoming Features
---

Add global border radius token to theme and replace harcoded values where borderRadius = 0 ([#11169](https://github.com/linode/manager/pull/11169))
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ const StyledButton = styled(Button)(({ theme }) => ({
border: 'none',
},
border: 'none',
borderRadius: 0,
borderRadius: theme.tokens.borderRadius.None,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Personally, I think it's easier just to type 0 than theme.tokens.borderRadius.None

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree it's shorter, but what tokens provide is essentially semantic clarity and intent. Often you'll hear alias tokens be referred to as semantic tokens in that using the token makes it clear this was an intentional design decision rather than a one-off value. So granted None will always mean 0 in this case, there's other benefits we obtain from this approach as well

height: 34,
minHeight: 'fit-content',
minWidth: 30,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ export const useStyles = makeStyles()((theme: Theme) => ({
},
backgroundColor: theme.bg.white,
border: `1px solid transparent`,
borderRadius: 0,
borderRadius: theme.tokens.borderRadius.None,
boxShadow: 'none',
minHeight: `calc(${theme.spacing(5)} - 2)`,
},
Expand Down Expand Up @@ -122,7 +122,7 @@ export const useStyles = makeStyles()((theme: Theme) => ({
},
'& .react-select__menu': {
border: `1px solid ${theme.palette.primary.main}`,
borderRadius: 0,
borderRadius: theme.tokens.borderRadius.None,
boxShadow: 'none',
margin: '-1px 0 0 0',
maxWidth: 415,
Expand Down Expand Up @@ -298,7 +298,7 @@ export const reactSelectStyles = (theme: Theme) => ({
},
backgroundColor: theme.bg.white,
border: `1px solid transparent`,
borderRadius: 0,
borderRadius: theme.tokens.borderRadius.None,
boxShadow: 'none',
minHeight: `calc(${theme.spacing(5)} - 2)`,
}),
Expand Down Expand Up @@ -330,7 +330,7 @@ export const reactSelectStyles = (theme: Theme) => ({
menu: (base: any) => ({
...base,
border: `1px solid ${theme.palette.primary.main}`,
borderRadius: 0,
borderRadius: theme.tokens.borderRadius.None,
boxShadow: 'none',
left: -1,
margin: 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ const useStyles = makeStyles()((theme: Theme) => ({
color: theme.palette.primary.light,
},
alignItems: 'flex-start',
borderRadius: 0,
borderRadius: theme.tokens.borderRadius.None,
cursor: 'pointer',
display: 'flex',
margin: `0 ${theme.spacing(1)} 2px 0`,
Expand Down
4 changes: 2 additions & 2 deletions packages/manager/src/components/Tag/Tag.styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export const StyledDeleteButton = styled(StyledLinkButton, {
label: 'StyledDeleteButton',
})(({ theme }) => ({
'& svg': {
borderRadius: 0,
borderRadius: theme.tokens.borderRadius.None,
color: theme.color.tagIcon,
height: 15,
width: 15,
Expand All @@ -94,7 +94,7 @@ export const StyledDeleteButton = styled(StyledLinkButton, {
borderLeft: `1px solid ${
theme.name === 'light' ? theme.tokens.color.Neutrals.White : '#2e3238'
}`,
borderRadius: 0,
borderRadius: theme.tokens.borderRadius.None,
borderTopRightRadius: 3,
height: 30,
margin: 0,
Expand Down
2 changes: 1 addition & 1 deletion packages/manager/src/components/TagCell/TagCell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ const StyledIconButton = styled(IconButton)(({ theme }) => ({
color: theme.tokens.color.Neutrals.White,
},
backgroundColor: theme.color.tagButtonBg,
borderRadius: 0,
borderRadius: theme.tokens.borderRadius.None,
color: theme.color.tagIcon,
height: 30,
marginLeft: theme.spacing(0.5),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export const StyledDebouncedSearchTextfield = styled(DebouncedSearchTextField, {
'& .input': {
backgroundColor: theme.bg.bgPaper,
border: `1px solid ${theme.color.grey3}`,
borderRadius: 0,
borderRadius: theme.tokens.borderRadius.None,
minHeight: 'auto',
minWidth: 415,
},
Expand Down
3 changes: 3 additions & 0 deletions packages/ui/src/foundations/themes/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import type {
ActionTypes as ActionTypesLight,
BackgroundTypes as BackgroundTypesLight,
BorderTypes as BorderTypesLight,
BorderRadiusTypes,
ChartTypes,
ColorTypes,
ContentTypes as ContentTypesLight,
Expand Down Expand Up @@ -107,6 +108,7 @@ declare module '@mui/material/styles/createTheme' {
notificationToast: NotificationToast;
tokens: {
// ---- Global tokens: theme agnostic ----
borderRadius: BorderRadiusTypes;
color: ColorTypes;
font: FontTypes;
spacing: SpacingTypes;
Expand Down Expand Up @@ -143,6 +145,7 @@ declare module '@mui/material/styles/createTheme' {
notificationToast?: NotificationToast;
tokens?: {
// ---- Global tokens: theme agnostic ----
borderRadius?: BorderRadiusTypes;
color?: ColorTypes;
font?: FontTypes;
spacing?: SpacingTypes;
Expand Down
2 changes: 2 additions & 0 deletions packages/ui/src/foundations/themes/light.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {
Action,
Background,
Border,
BorderRadius,
Button,
Chart,
Color,
Expand Down Expand Up @@ -1642,6 +1643,7 @@ export const lightTheme: ThemeOptions = {
action: Action,
background: Background,
border: Border,
borderRadius: BorderRadius,
color: Color,
chart: Chart,
content: Content,
Expand Down