Skip to content
Merged
Show file tree
Hide file tree
Changes from 8 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
6 changes: 3 additions & 3 deletions docs/development-guide/16-design-tokens.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Our design system provides tokens via the `theme.tokens` object, which contains
theme.tokens.spacing.S16 // "1rem"

// Accessing typography tokens
theme.tokens.typography.Heading.Xxl // "800 1.625rem/2rem 'Nunito Sans'"
theme.tokens.alias.Typography.Heading.Xxl // "800 1.625rem/2rem 'Nunito Sans'"
```

### ⚠️ Warning: Global vs. Theme-Sensitive Tokens
Expand All @@ -21,9 +21,9 @@ theme.tokens.typography.Heading.Xxl // "800 1.625rem/2rem 'Nunito Sans'"
<Paper sx={(theme) => ({ backgroundColor: theme.tokens.color.Neutral[5] })}>

// βœ… Correct: Using alias (semantic) color tokens
<Paper sx={(theme) => ({ backgroundColor: theme.tokens.content.Background.Normal })}>
<Paper sx={(theme) => ({ backgroundColor: theme.tokens.alias.Content.Background.Normal })}>

<Paper sx={(theme) => ({ backgroundColor: theme.semanticTokens.textColors.primary })}>
<Paper sx={(theme) => ({ backgroundColor: theme.tokens.alias.Content.Text.Primary })}>
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I changed this btw since semanticTokens is not a thing

```

### Best Practices for Token Usage
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ const StyledButton = styled(Button)(({ theme }) => ({
border: 'none',
},
border: 'none',
borderRadius: theme.tokens.borderRadius.None,
borderRadius: theme.tokens.alias.Radius.Default,
height: 34,
minHeight: 'fit-content',
minWidth: 30,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const useStyles = makeStyles()((theme: Theme) => ({
},
root: {
alignItems: 'center',
borderRadius: theme.tokens.borderRadius.None,
borderRadius: theme.tokens.alias.Radius.Default,
display: 'flex',
gap: theme.spacing(2),
padding: theme.spacing(0.5),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export const PaginationFooter = (props: Props) => {
<Box
sx={{
background: theme.bg.bgPaper,
border: `1px solid ${theme.tokens.table.Row.Border}`,
border: `1px solid ${theme.tokens.component.Table.Row.Border}`,
borderTop: 0,
...sx,
}}
Expand Down
23 changes: 12 additions & 11 deletions packages/manager/src/components/PrimaryNav/PrimaryNav.styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export const StyledAkamaiLogo = styled(AkamaiLogo, {
export const StyledDivider = styled(Divider, {
label: 'StyledDivider',
})(({ theme }) => ({
borderColor: theme.tokens.border.Normal,
borderColor: theme.tokens.alias.Border.Normal,
margin: 0,
}));

Expand All @@ -38,7 +38,7 @@ export const StyledActiveLink = styled(Link, {
alignItems: 'center',
cursor: 'pointer',
display: 'flex',
font: theme.tokens.typography.Body.Semibold,
font: theme.tokens.alias.Typography.Body.Semibold,
height: 32,
minWidth: SIDEBAR_WIDTH,
padding: `8px 8px 8px 48px`,
Expand All @@ -57,11 +57,11 @@ export const StyledPrimaryLinkBox = styled(Box, {
? theme.tokens.color.Brand[60]
: theme.tokens.color.Neutrals['White'],
display: 'flex',
font: theme.tokens.typography.Label.Semibold.S,
font: theme.tokens.alias.Typography.Label.Semibold.S,
transition: theme.transitions.create(['color', 'opacity']),
width: '100%',
...(props.isActiveLink && {
font: theme.tokens.typography.Body.Bold,
font: theme.tokens.alias.Typography.Body.Bold,
}),
...(props.isCollapsed && {
opacity: 0,
Expand All @@ -80,7 +80,8 @@ export const StyledAccordion = styled(Accordion, {
fontSize: theme.tokens.font.FontSize.Xxxs,
// eslint-disable-next-line
fontWeight: theme.tokens.font.FontWeight.Extrabold,
letterSpacing: theme.tokens.typography.Heading.OverlineLetterSpacing,
letterSpacing:
theme.tokens.alias.Typography.Heading.OverlineLetterSpacing,
lineHeight: theme.tokens.font.LineHeight.Xxxs,
paddingLeft: theme.tokens.spacing.S12,
paddingRight: theme.tokens.spacing.S12,
Expand All @@ -101,7 +102,7 @@ export const StyledAccordion = styled(Accordion, {
},
alignItems: 'center',
display: 'flex',
font: theme.tokens.typography.Label.Bold.S,
font: theme.tokens.alias.Typography.Label.Bold.S,
},
'.MuiAccordionDetails-root': {
padding: 0,
Expand Down Expand Up @@ -150,15 +151,15 @@ export const StyledChip = styled(Chip, {
shouldForwardProp: omittedProps(['isActiveLink']),
})<{ isActiveLink: boolean }>(({ theme, ...props }) => ({
backgroundColor: props.isActiveLink
? theme.tokens.sideNavigation.SelectedMenuItem.Label.Background
: theme.tokens.sideNavigation.DefaultMenuItem.Label.Background,
? theme.tokens.component.SideNavigation.SelectedMenuItem.Label.Background
: theme.tokens.component.SideNavigation.DefaultMenuItem.Label.Background,
border: !props.isActiveLink
? `1px solid ${theme.tokens.sideNavigation.DefaultMenuItem.Label.Border}`
? `1px solid ${theme.tokens.component.SideNavigation.DefaultMenuItem.Label.Border}`
: 'none',
borderRadius: '2px',
color: props.isActiveLink
? theme.tokens.sideNavigation.SelectedMenuItem.Label.Text
: theme.tokens.sideNavigation.DefaultMenuItem.Label.Text,
? theme.tokens.component.SideNavigation.SelectedMenuItem.Label.Text
: theme.tokens.component.SideNavigation.DefaultMenuItem.Label.Text,
marginRight: '12px',
overflow: 'hidden',
whiteSpace: 'nowrap',
Expand Down
2 changes: 1 addition & 1 deletion packages/manager/src/components/PrimaryNav/SideMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ const StyledDrawer = styled(Drawer, {
overflow: 'hidden',
position: 'absolute',
[theme.breakpoints.up('md')]: {
borderRight: `1px solid ${theme.tokens.sideNavigation.Border}`,
borderRight: `1px solid ${theme.tokens.component.SideNavigation.Border}`,
},
transform: 'none',
transition: 'width linear 100ms, height linear 250ms',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export const RegionOption = ({
{item.id === 'global' ? (
<PublicIcon
sx={(theme) => ({
color: `${theme.tokens.content.Icon.Primary.Active}`,
color: `${theme.tokens.alias.Content.Icon.Primary.Active}`,
})}
className="public-icon"
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ export const CardBaseSubheading = styled('div', {
label: 'CardBaseSubheading',
})<Partial<CardBaseProps>>(({ theme, ...props }) => ({
color: props.checked
? theme.tokens.content.Text.Primary.Default
? theme.tokens.alias.Content.Text.Primary.Default
: theme.palette.text.primary,
fontSize: '0.875rem',
}));
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 @@ -68,7 +68,7 @@ export const StyledDeleteButton = styled(StyledLinkButton, {
label: 'StyledDeleteButton',
})(({ theme }) => ({
'& svg': {
borderRadius: theme.tokens.borderRadius.None,
borderRadius: theme.tokens.alias.Radius.Default,
color: theme.color.tagIcon,
height: 15,
width: 15,
Expand All @@ -85,7 +85,7 @@ export const StyledDeleteButton = styled(StyledLinkButton, {
? theme.tokens.color.Neutrals.White
: theme.tokens.color.Neutrals[100]
}`,
borderRadius: theme.tokens.borderRadius.None,
borderRadius: theme.tokens.alias.Radius.Default,
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 @@ -241,7 +241,7 @@ const StyledIconButton = styled(IconButton)(({ theme }) => ({
color: theme.tokens.color.Neutrals.White,
},
backgroundColor: theme.color.tagButtonBg,
borderRadius: theme.tokens.borderRadius.None,
borderRadius: theme.tokens.alias.Radius.Default,
color: theme.color.tagIcon,
height: 30,
marginLeft: theme.spacing(0.5),
Expand Down
4 changes: 2 additions & 2 deletions packages/manager/src/features/Account/CloseAccountDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ const CloseAccountDialog = ({ closeDialog, open }: Props) => {
type: 'AccountSetting',
}}
typographyStyleSx={(theme) => ({
borderTop: `1px solid ${theme.tokens.border.Normal}`,
borderTop: `1px solid ${theme.tokens.alias.Border.Normal}`,
marginBottom: theme.tokens.spacing.S8,
marginTop: theme.tokens.spacing.S16,
paddingTop: theme.tokens.spacing.S16,
Expand All @@ -104,7 +104,7 @@ const CloseAccountDialog = ({ closeDialog, open }: Props) => {
<StyledNoticeWrapper>
<Notice
sx={(theme) => ({
border: `1px solid ${theme.tokens.action.Negative.Default}`,
border: `1px solid ${theme.tokens.alias.Action.Negative.Default}`,
})}
important
spacingBottom={12}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ export const QuotasIncreaseForm = (props: QuotasIncreaseFormProps) => {
endAdornment: (
<Typography
sx={(theme) => ({
color: theme.tokens.content.Text,
color: theme.tokens.alias.Content.Text,
font: theme.font.bold,
fontSize: theme.tokens.font.FontSize.Xxxs,
mx: 1,
Expand Down Expand Up @@ -177,7 +177,7 @@ export const QuotasIncreaseForm = (props: QuotasIncreaseFormProps) => {
>
<Stack
sx={(theme) => ({
backgroundColor: theme.tokens.background.Neutral,
backgroundColor: theme.tokens.alias.Background.Neutral,
p: 2,
})}
data-testid="quota-increase-form-preview-content"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,17 +171,17 @@ export const StyledAlertChip = styled(Chip, {
borderRadius?: string;
}>(({ borderRadius, theme }) => ({
'& .MuiChip-label': {
color: theme.tokens.content.Text.Primary.Default,
color: theme.tokens.alias.Content.Text.Primary.Default,
marginRight: theme.spacing(1),
},
backgroundColor: theme.tokens.background.Normal,
backgroundColor: theme.tokens.alias.Background.Normal,
borderRadius: borderRadius || 0,
height: theme.spacing(3),
}));

export const StyledAlertTypography = styled(Typography, {
label: 'StyledAlertTypography',
})(({ theme }) => ({
color: theme.tokens.content.Text.Primary.Default,
color: theme.tokens.alias.Content.Text.Primary.Default,
fontSize: theme.typography.body1.fontSize,
}));
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export const AlertsResourcesNotice = React.memo(
<StyledNotice gap={1} variant="info">
<Typography
sx={(theme) => ({
fontFamily: theme.tokens.typography.Body.Bold,
fontFamily: theme.tokens.alias.Typography.Body.Bold,
})}
data-testid="selection_notice"
>
Expand All @@ -54,7 +54,7 @@ export const AlertsResourcesNotice = React.memo(
export const StyledNotice = styled(Notice, { label: 'StyledNotice' })(
({ theme }) => ({
alignItems: 'center',
background: theme.tokens.background.Normal,
background: theme.tokens.alias.Background.Normal,
borderRadius: 1,
display: 'flex',
flexWrap: 'nowrap',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export const AlertInformationActionRow = (
<TableCell>
<Typography
sx={(theme) => ({
font: theme.tokens.typography.Label.Regular.S,
font: theme.tokens.alias.Typography.Label.Regular.S,
})}
>
{capitalize(type)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export const MetricThreshold = (props: MetricThresholdProps) => {
return (
<Typography
sx={(theme) => ({
font: theme.tokens.typography.Label.Regular.S,
font: theme.tokens.alias.Typography.Label.Regular.S,
})}
>
-
Expand All @@ -31,7 +31,7 @@ export const MetricThreshold = (props: MetricThresholdProps) => {
return (
<Typography
sx={(theme) => ({
font: theme.tokens.typography.Label.Regular.S,
font: theme.tokens.alias.Typography.Label.Regular.S,
})}
>
{metric}
Expand All @@ -48,7 +48,7 @@ export const MetricThreshold = (props: MetricThresholdProps) => {
<Box alignItems="center" display="flex" gap={1.75}>
<Typography
sx={(theme) => ({
font: theme.tokens.typography.Label.Regular.S,
font: theme.tokens.alias.Typography.Label.Regular.S,
})}
>
{metric}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ export const AddNotificationChannelDrawer = (
>
<Typography
sx={(theme) => ({
color: theme.tokens.content.Text,
color: theme.tokens.alias.Content.Text,
})}
gutterBottom
variant="h3"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export const EditAlertResourcesConfirmDialog = React.memo(
>
<Typography
sx={(theme) => ({
font: theme.tokens.typography.Body,
font: theme.tokens.alias.Typography.Body,
})}
variant="body1"
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export const AlertsNoticeMessage = (props: AlertsNoticeProps) => {
<StyledNotice variant={variant}>
<Typography
sx={(theme) => ({
fontFamily: theme.tokens.typography.Body.Bold,
fontFamily: theme.tokens.alias.Typography.Body.Bold,
})}
data-testid="alert_message_notice"
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ export const getServiceTypeLabel = (
* @returns The style object for the box used in alert details page
*/
export const getAlertBoxStyles = (theme: Theme) => ({
backgroundColor: theme.tokens.background.Neutral,
backgroundColor: theme.tokens.alias.Background.Neutral,
padding: theme.spacing(3),
});
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export const useStyles = makeStyles()((theme: Theme) => ({
'& span': {
font: theme.font.bold,
},
background: theme.tokens.interaction.Background.Secondary,
background: theme.tokens.alias.Interaction.Background.Secondary,
border: `1px solid ${
theme.name === 'light'
? theme.tokens.color.Neutrals[40]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -335,8 +335,8 @@ const FirewallRuleTableRow = React.memo((props: FirewallRuleTableRowProps) => {
},
':focus': {
backgroundColor: isActive
? theme.tokens.background.Neutralsubtle
: theme.tokens.background.Normal,
? theme.tokens.alias.Background.Neutralsubtle
: theme.tokens.alias.Background.Normal,
},
cursor: isActive ? 'grabbing' : 'grab',
position: 'relative',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export const PublicTemplateRules = () => {
</Typography>
<Box
sx={(theme) => ({
backgroundColor: theme.tokens.background.Neutral,
backgroundColor: theme.tokens.alias.Background.Neutral,
marginTop: theme.spacing(2),
padding: theme.spacing(2),
})}
Expand All @@ -30,7 +30,7 @@ export const PublicTemplateRules = () => {
};

const templateRuleStyling = (theme: Theme) => ({
backgroundColor: theme.tokens.background.Neutral,
backgroundColor: theme.tokens.alias.Background.Neutral,
marginTop: theme.spacing(1),
padding: `${theme.spacing(1)} ${theme.spacing(2)}`,
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export const VPCTemplateRules = () => {
</Typography>
<Box
sx={(theme) => ({
backgroundColor: theme.tokens.background.Neutral,
backgroundColor: theme.tokens.alias.Background.Neutral,
marginTop: theme.spacing(2),
padding: theme.spacing(2),
})}
Expand Down
8 changes: 4 additions & 4 deletions packages/manager/src/features/Footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export const Footer = React.memo(() => {
xs: 'column',
}}
sx={(theme) => ({
borderTop: `1px solid ${theme.tokens.footer.Border}`,
borderTop: `1px solid ${theme.tokens.component.GlobalFooter.Border}`,
padding: `12px 16px`,
})}
textAlign={{
Expand Down Expand Up @@ -66,7 +66,7 @@ export const Footer = React.memo(() => {
>
<Typography
sx={(theme) => ({
color: theme.tokens.content.Text.Primary.Default,
color: theme.tokens.alias.Content.Text.Primary.Default,
})}
variant="body1"
>
Expand All @@ -84,7 +84,7 @@ const StyledLink = styled(Link)(({ theme }) => ({
marginLeft: 0,
},
'&:hover': {
color: theme.tokens.footer.Link.Hover,
color: theme.tokens.component.GlobalFooter.Link.Hover,
},
color: theme.tokens.footer.Link.Default,
color: theme.tokens.component.GlobalFooter.Link.Default,
}));
Loading
Loading