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-8754] - Add Alias Tokens to the Theme #11138

Merged
13 changes: 13 additions & 0 deletions packages/ui/src/foundations/themes/dark.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
import {
Accent,
Action,
Background,
Badge,
Border,
Button,
Color,
Content,
Dropdown,
Elevation,
Interaction,
NotificationToast,
Select,
TextField,
Typography,
} from '@linode/design-language-system/themes/dark';

import { breakpoints } from '../breakpoints';
Expand Down Expand Up @@ -181,6 +187,8 @@ const genericTableHeaderStyle = {
};

export const darkTheme: ThemeOptions = {
accentTokens: Accent,
actionTokens: Action,
animateCircleIcon: {
...iconCircleAnimation,
},
Expand All @@ -193,8 +201,10 @@ export const darkTheme: ThemeOptions = {
applyTableHeaderStyles: {
...genericTableHeaderStyle,
},
backgroundTokens: Background,
bg: customDarkModeOptions.bg,
borderColors: customDarkModeOptions.borderColors,
borderTokens: Border,
breakpoints,
color: customDarkModeOptions.color,
components: {
Expand Down Expand Up @@ -791,6 +801,8 @@ export const darkTheme: ThemeOptions = {
},
},
},
contentTokens: Content,
elevationTokens: Elevation,
graphs: {
cpu: {
percent: `rgb(54, 131, 220)`,
Expand Down Expand Up @@ -890,4 +902,5 @@ export const darkTheme: ThemeOptions = {
color: primaryColors.text,
},
},
typographyTokens: Typography,
};
40 changes: 39 additions & 1 deletion packages/ui/src/foundations/themes/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,26 @@ import { darkTheme } from './dark';
import { lightTheme, inputMaxWidth as _inputMaxWidth } from './light';

import type {
AccentTypes as AccentTypesLight,
ActionTypes as ActionTypesLight,
BackgroundTypes as BackgroundTypesLight,
BorderTypes as BorderTypesLight,
ChartTypes,
ContentTypes as ContentTypesLight,
ElevationTypes as ElevationTypesLight,
InteractionTypes as InteractionTypesLight,
TypographyTypes,
RadiusTypes,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Typography and Radius are the same for light/dark so simplified our Theme/ThemeOptions for now

} from '@linode/design-language-system';
import type { InteractionTypes as InteractionTypesDark } from '@linode/design-language-system/themes/dark';
import type {
AccentTypes as AccentTypesDark,
ActionTypes as ActionTypesDark,
BackgroundTypes as BackgroundTypesDark,
BorderTypes as BorderTypesDark,
ContentTypes as ContentTypesDark,
ElevationTypes as ElevationTypesDark,
InteractionTypes as InteractionTypesDark,
} from '@linode/design-language-system/themes/dark';
import type { latoWeb } from '../fonts';
// Types & Interfaces
import type {
Expand All @@ -25,6 +41,12 @@ import type {

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

type AccentTypes = MergeTypes<AccentTypesLight, AccentTypesDark>;
type ActionTypes = MergeTypes<ActionTypesLight, ActionTypesDark>;
type BackgroundTypes = MergeTypes<BackgroundTypesLight, BackgroundTypesDark>;
type BorderTypes = MergeTypes<BorderTypesLight, BorderTypesDark>;
type ContentTypes = MergeTypes<ContentTypesLight, ContentTypesDark>;
type ElevationTypes = MergeTypes<ElevationTypesLight, ElevationTypesDark>;
type InteractionTypes = MergeTypes<InteractionTypesLight, InteractionTypesDark>;

type Fonts = typeof latoWeb;
Expand Down Expand Up @@ -65,42 +87,58 @@ type NotificationToast = MergeTypes<
*/
declare module '@mui/material/styles/createTheme' {
interface Theme {
accentTokens: AccentTypes;
actionTokens: ActionTypes;
addCircleHoverEffect?: any;
animateCircleIcon?: any;
applyLinkStyles?: any;
applyStatusPillStyles?: any;
applyTableHeaderStyles?: any;
backgroundTokens: BackgroundTypes;
bg: BgColors;
borderColors: BorderColors;
borderTokens: BorderTypes;
chartTokens: ChartTypes;
color: Colors;
contentTokens: ContentTypes;
elevationTokens: ElevationTypes;
font: Fonts;
graphs: any;
inputStyles: any;
interactionTokens: InteractionTypes;
name: ThemeName;
notificationToast: NotificationToast;
radiusTokens: RadiusTypes;
textColors: TextColors;
typographyTokens: TypographyTypes;
visually: any;
}

interface ThemeOptions {
accentTokens?: AccentTypes;
actionTokens?: ActionTypes;
addCircleHoverEffect?: any;
animateCircleIcon?: any;
applyLinkStyles?: any;
applyStatusPillStyles?: any;
applyTableHeaderStyles?: any;
backgroundTokens?: BackgroundTypes;
bg?: DarkModeBgColors | LightModeBgColors;
borderColors?: DarkModeBorderColors | LightModeBorderColors;
borderTokens?: BorderTypes;
chartTokens?: ChartTypes;
color?: DarkModeColors | LightModeColors;
contentTokens?: ContentTypes;
elevationTokens?: ElevationTypes;
font?: Fonts;
graphs?: any;
inputStyles?: any;
interactionTokens?: InteractionTypes;
name: ThemeName;
notificationToast?: NotificationToast;
radiusTokens?: RadiusTypes;
textColors?: DarkModeTextColors | LightModeTextColors;
typographyTokens?: TypographyTypes;
visually?: any;
}
}
Expand Down
14 changes: 14 additions & 0 deletions packages/ui/src/foundations/themes/light.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
import {
Accent,
Action,
Background,
Border,
Button,
Chart,
Color,
Content,
Dropdown,
Elevation,
Interaction,
NotificationToast,
Radius,
Select,
Typography,
} from '@linode/design-language-system';

import { breakpoints } from '../breakpoints';
Expand Down Expand Up @@ -221,6 +227,8 @@ const graphTransparency = '0.7';
const spacing = 8;

export const lightTheme: ThemeOptions = {
accentTokens: Accent,
actionTokens: Action,
addCircleHoverEffect: {
...iconCircleHoverEffect,
},
Expand All @@ -236,8 +244,10 @@ export const lightTheme: ThemeOptions = {
applyTableHeaderStyles: {
...genericTableHeaderStyle,
},
backgroundTokens: Background,
bg,
borderColors,
borderTokens: Border,
breakpoints,
chartTokens: Chart,
color,
Expand Down Expand Up @@ -1461,6 +1471,8 @@ export const lightTheme: ThemeOptions = {
},
},
},
contentTokens: Content,
elevationTokens: Elevation,
font: {
bold: latoWeb.bold,
normal: latoWeb.normal,
Expand Down Expand Up @@ -1601,6 +1613,7 @@ export const lightTheme: ThemeOptions = {
main: Color.Amber[40],
},
},
radiusTokens: Radius,
shadows: [
'none',
'none',
Expand Down Expand Up @@ -1671,6 +1684,7 @@ export const lightTheme: ThemeOptions = {
lineHeight: '1.5rem',
},
},
typographyTokens: Typography,
visually: {
hidden: visuallyHidden,
visible: visuallyVisible,
Expand Down