Skip to content

Commit

Permalink
upcoming: [M3-6538] - Add Interaction Tokens, Minimally Cleanup Theme…
Browse files Browse the repository at this point in the history
… Files (#11078)

* upcoming: [M3-6538] - Add Interaction Tokens, Minimally Cleanup Theme Files

* Add changeset

---------

Co-authored-by: Jaalah Ramos <jaalah.ramos@gmail.com>
  • Loading branch information
jaalah-akamai and jaalah authored Oct 11, 2024
1 parent 60a1925 commit 77174ca
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 22 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@linode/manager": Upcoming Features
---

Add Interaction Tokens, Minimally Cleanup Theme Files ([#11078](https://github.com/linode/manager/pull/11078))
4 changes: 0 additions & 4 deletions packages/manager/src/components/ColorPalette/ColorPalette.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,6 @@ export const ColorPalette = () => {
alias: 'theme.bg.bgPaper',
color: theme.bg.bgPaper,
},
{
alias: 'theme.bg.bgAccessRow',
color: theme.bg.bgAccessRow,
},
{
alias: 'theme.bg.bgAccessRowTransparentGradient',
color: theme.bg.bgAccessRowTransparentGradient,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ const useStyles = makeStyles()((theme: Theme) => ({
'& span': {
fontFamily: theme.font.bold,
},
background: theme.bg.bgAccessRow,
background: theme.interactionTokens.Background.Secondary,
border: `1px solid ${theme.name === 'light' ? '#ccc' : '#222'}`,
padding: '8px 15px',
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ export const StyledTableCell = styled(TableCell, { label: 'StyledTableCell' })(
fontSize: 15,
},
alignItems: 'center',
backgroundColor: theme.bg.bgAccessRow,
backgroundColor: theme.interactionTokens.Background.Secondary,
color: theme.textColors.tableStatic,
display: 'flex',
fontFamily: '"UbuntuMono", monospace, sans-serif',
Expand All @@ -180,7 +180,7 @@ export const StyledCopyTooltip = styled(CopyTooltip, {
export const StyledGradientDiv = styled('div', { label: 'StyledGradientDiv' })(
({ theme }) => ({
'&:after': {
backgroundImage: `linear-gradient(to right, ${theme.bg.bgAccessRowTransparentGradient}, ${theme.bg.bgAccessRow});`,
backgroundImage: `linear-gradient(to right, ${theme.bg.bgAccessRowTransparentGradient}, ${theme.interactionTokens.Background.Secondary});`,
bottom: 0,
content: '""',
height: '100%',
Expand Down
5 changes: 1 addition & 4 deletions packages/manager/src/foundations/themes/dark.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import {
Action,
Badge,
Button,
Chart,
Color,
Dropdown,
Interaction,
Expand Down Expand Up @@ -38,7 +37,6 @@ export const customDarkModeOptions = {
bg: {
app: Color.Neutrals[100],
appBar: tempReplacementforColorNeutralsBlack,
bgAccessRow: Color.Neutrals[80],
bgAccessRowTransparentGradient: 'rgb(69, 75, 84, .001)',
bgPaper: Color.Neutrals[90],
interactionBgPrimary: Interaction.Background.Secondary,
Expand All @@ -58,7 +56,6 @@ export const customDarkModeOptions = {
borderTypography: Color.Neutrals[80],
divider: Color.Neutrals[80],
},
charts: { ...Chart },
color: {
black: Color.Neutrals.White,
blueDTwhite: Color.Neutrals.White,
Expand Down Expand Up @@ -199,7 +196,6 @@ export const darkTheme: ThemeOptions = {
bg: customDarkModeOptions.bg,
borderColors: customDarkModeOptions.borderColors,
breakpoints,
charts: customDarkModeOptions.charts,
color: customDarkModeOptions.color,
components: {
MuiAppBar: {
Expand Down Expand Up @@ -856,6 +852,7 @@ export const darkTheme: ThemeOptions = {
color: Select.Hover.Text,
},
},
interactionTokens: Interaction,
name: 'dark',
notificationToast,
palette: {
Expand Down
17 changes: 10 additions & 7 deletions packages/manager/src/foundations/themes/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,11 @@ import { darkTheme } from 'src/foundations/themes/dark';
import { lightTheme } from 'src/foundations/themes/light';
import { deepMerge } from 'src/utilities/deepMerge';

import type { Chart as ChartLight } from '@linode/design-language-system';
import type { Chart as ChartDark } from '@linode/design-language-system/themes/dark';
import type {
ChartTypes,
InteractionTypes as InteractionTypesLight,
} from '@linode/design-language-system';
import type { InteractionTypes as InteractionTypesDark } from '@linode/design-language-system/themes/dark';
import type { latoWeb } from 'src/foundations/fonts';
// Types & Interfaces
import type {
Expand All @@ -23,9 +26,7 @@ import type {

export type ThemeName = 'dark' | 'light';

type ChartLightTypes = typeof ChartLight;
type ChartDarkTypes = typeof ChartDark;
type ChartTypes = MergeTypes<ChartLightTypes, ChartDarkTypes>;
type InteractionTypes = MergeTypes<InteractionTypesLight, InteractionTypesDark>;

type Fonts = typeof latoWeb;

Expand Down Expand Up @@ -72,11 +73,12 @@ declare module '@mui/material/styles/createTheme' {
applyTableHeaderStyles?: any;
bg: BgColors;
borderColors: BorderColors;
charts: ChartTypes;
chartTokens: ChartTypes;
color: Colors;
font: Fonts;
graphs: any;
inputStyles: any;
interactionTokens: InteractionTypes;
name: ThemeName;
notificationToast: NotificationToast;
textColors: TextColors;
Expand All @@ -91,11 +93,12 @@ declare module '@mui/material/styles/createTheme' {
applyTableHeaderStyles?: any;
bg?: DarkModeBgColors | LightModeBgColors;
borderColors?: DarkModeBorderColors | LightModeBorderColors;
charts: ChartTypes;
chartTokens?: ChartTypes;
color?: DarkModeColors | LightModeColors;
font?: Fonts;
graphs?: any;
inputStyles?: any;
interactionTokens?: InteractionTypes;
name: ThemeName;
notificationToast?: NotificationToast;
textColors?: DarkModeTextColors | LightModeTextColors;
Expand Down
6 changes: 2 additions & 4 deletions packages/manager/src/foundations/themes/light.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,9 @@ import type { ThemeOptions } from '@mui/material/styles';

export const inputMaxWidth = 416;

export const charts = { ...Chart } as const;

export const bg = {
app: Color.Neutrals[5],
appBar: 'transparent',
bgAccessRow: Color.Neutrals[5],
bgAccessRowTransparentGradient: 'rgb(255, 255, 255, .001)',
bgPaper: Color.Neutrals.White,
interactionBgPrimary: Interaction.Background.Secondary,
Expand Down Expand Up @@ -242,7 +239,7 @@ export const lightTheme: ThemeOptions = {
bg,
borderColors,
breakpoints,
charts,
chartTokens: Chart,
color,
components: {
MuiAccordion: {
Expand Down Expand Up @@ -1574,6 +1571,7 @@ export const lightTheme: ThemeOptions = {
color: Select.Hover.Text,
},
},
interactionTokens: Interaction,
name: 'light', // @todo remove this because we leverage pallete.mode now
notificationToast,
palette: {
Expand Down

0 comments on commit 77174ca

Please sign in to comment.