Skip to content

Commit 7d9e44c

Browse files
committed
add tokens
Signed-off-by: aabidsofi19 <mailtoaabid01@gmail.com>
1 parent 72e12d7 commit 7d9e44c

5 files changed

Lines changed: 41 additions & 60 deletions

File tree

src/custom/Modal/index.tsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ const FullscreenExitButton = styled(FullScreenExitIcon)(({ theme }) => ({
7474
}));
7575

7676
export const ModalStyledHeader = styled('div')(({ theme }) => ({
77-
background: theme.palette.mode === 'light' ? lightModalGradient.header : darkModalGradient.header,
77+
background: theme.palette.surface.tint,
7878
color: '#eee',
7979
display: 'flex',
8080
justifyContent: 'space-between',
@@ -119,7 +119,7 @@ export const useModal = ({ headerIcon }: { headerIcon: React.ReactNode }): UseMo
119119

120120
export const ModalBody = styled(Paper)(({ theme }) => ({
121121
padding: '1rem',
122-
backgroundColor: theme.palette.background.surfaces,
122+
backgroundColor: theme.palette.surface.primary,
123123
overflowY: 'auto',
124124
height: '100%',
125125
scrollbarWidth: 'none',
@@ -134,9 +134,7 @@ const StyledFooter = styled('div', {
134134
})<ModalFooterProps>(({ theme, variant, hasHelpText }) => ({
135135
background:
136136
variant === 'filled'
137-
? theme.palette.mode === 'light'
138-
? lightModalGradient.fotter
139-
: darkModalGradient.fotter
137+
? (theme.palette.surface.tint)
140138
: 'transparent',
141139
display: 'flex',
142140
alignItems: 'center',

src/theme/ThemeProvider.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { EmotionCache } from '@emotion/react';
2-
import { CssBaseline, Interactiveness, PaletteMode, Theme, ThemeProvider } from '@mui/material';
2+
import { CssBaseline, PaletteMode, Theme, ThemeProvider } from '@mui/material';
33
import React from 'react';
4-
import { createCustomTheme } from './theme';
4+
import { createCustomTheme,PrimitivePalette } from './theme';
55

66
interface SistentProviderContextType {
77
emotionCache?: EmotionCache;
@@ -13,7 +13,7 @@ export interface SistentThemeProviderProps {
1313
children: React.ReactNode;
1414
emotionCache?: EmotionCache;
1515
initialMode?: PaletteMode;
16-
customTheme?: Interactiveness;
16+
customTheme?: PrimitivePalette;
1717
}
1818

1919
function SistentThemeProvider({
@@ -23,7 +23,7 @@ function SistentThemeProvider({
2323
customTheme
2424
}: SistentThemeProviderProps): JSX.Element {
2525
const theme = React.useMemo<Theme>(
26-
() => createCustomTheme(initialMode, customTheme),
26+
() => createCustomTheme(initialMode, customTheme ),
2727
[initialMode, customTheme]
2828
);
2929
return (

src/theme/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import {
1111
} from '@mui/material';
1212
export { darkModePalette, lightModePalette } from './palette';
1313
export { typography } from './typography';
14-
14+
export {type PrimitivePalette} from "./theme";
1515
export * from './colors';
1616
export {
1717
default as SistentThemeProvider,

src/theme/palette.ts

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -272,15 +272,15 @@ export type ThemePalette = PaletteOptions
272272

273273
export const lightModePalette: PaletteOptions = {
274274

275-
surface: {
276-
primary: Colors.charcoal[100],
277-
secondary: Colors.charcoal[90],
278-
tertiary: Colors.charcoal[80],
279-
tint: Colors.charcoal[70],
280-
elevated: Colors.WHITE,
281-
overlay: alpha(Colors.charcoal[90], 0.8),
282-
inverse: Colors.charcoal[10]
283-
},
275+
surface: {
276+
primary: Colors.charcoal[100],
277+
secondary: Colors.charcoal[90],
278+
tertiary: Colors.charcoal[80],
279+
elevated: Colors.WHITE,
280+
overlay: alpha(Colors.charcoal[90], 0.8),
281+
inverse: Colors.charcoal[10],
282+
tint: `linear-gradient(90deg, ${Colors.TEAL_BLUE} 0%, ${Colors.DARK_TEAL} 100%)`
283+
} ,
284284

285285
interactive: {
286286
primary: Colors.KEPPEL,
@@ -292,8 +292,8 @@ export const lightModePalette: PaletteOptions = {
292292
},
293293

294294
navigation: {
295-
primary: Colors.charcoal[100],
296-
secondary: Colors.charcoal[90],
295+
primary: "#252e31",
296+
secondary: "#294957",
297297
active: Colors.KEPPEL,
298298
hover: Colors.keppel[50]
299299
},
@@ -432,8 +432,8 @@ export const darkModePalette: PaletteOptions = {
432432
tertiary: Colors.charcoal[30],
433433
elevated: Colors.charcoal[40],
434434
overlay: alpha(Colors.charcoal[20], 0.8),
435-
tint: Colors.charcoal[50],
436-
inverse: Colors.WHITE
435+
inverse: Colors.WHITE,
436+
tint: `linear-gradient(90deg, ${Colors.charcoal[30]} 0%, ${Colors.accentGrey[30]} 100%)`,
437437
},
438438
interactive: {
439439
primary: Colors.KEPPEL,

src/theme/theme.ts

Lines changed: 20 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Interactiveness, PaletteMode, createTheme, alpha,darken } from '@mui/material';
1+
import { PaletteMode, createTheme, alpha,darken } from '@mui/material';
22
import { components } from './components';
33
import { darkModePalette, lightModePalette, ThemePalette } from './palette';
44
import { typography } from './typography';
@@ -30,7 +30,7 @@ export type PrimitivePalette = {
3030
* Should be visually distinct from `background` to ensure
3131
* navigation elements stand out.
3232
*/
33-
NavigationBar: string;
33+
navigationBar: string;
3434

3535

3636
/**
@@ -125,20 +125,15 @@ export type PrimitivePalette = {
125125
*/
126126
foreground: string;
127127

128-
// @deprecated same as primary
129-
default?: string;
130-
// @deprecated same as secondary
131-
hover?: string;
132-
133128
};
134129

135130
import * as Colors from './colors';
136131

137132
/**
138133
* Layer5 ( primitives ) defines the raw, brand-level colors used in the UI.
139134
*/
140-
export const SistentDefaultPrimitivePalette: PrimitivePalette = {
141-
NavigationBar: "#252e31", // used for app navigation bar background
135+
export const SistentDefaultPrimitivePaletteLight: PrimitivePalette = {
136+
navigationBar: "#252e31", // used for app navigation bar background
142137

143138

144139
primary: Colors.KEPPEL, // maps to background.brand.default, success.default
@@ -155,39 +150,26 @@ export const SistentDefaultPrimitivePalette: PrimitivePalette = {
155150
};
156151

157152

158-
export const digitalOceanPrimitives: PrimitivePalette = {
159-
/** Distinct dark navy so the nav stands out from a white page background. */
160-
NavigationBar: "#031B4E",
161-
162-
/** DigitalOcean "Ocean Blue". */
163-
primary: "#0069FF",
164-
/** White text/icons on primary. */
165-
primaryInverted: "#FFFFFF",
153+
export const SistentDefaultPrimitivePaletteDark: PrimitivePalette = {
154+
navigationBar: "#252e31", // used for app navigation bar background
166155

167-
/** Slate/dark blue-gray used for secondary emphasis. */
168-
secondary: "#2E384D",
169-
/** White text/icons on secondary. */
170-
secondaryInverted: "#FFFFFF",
156+
primary: Colors.KEPPEL, // maps to background.brand.default, success.default
157+
primaryInverted: Colors.charcoal[100], // used for text on KEPL background
171158

172-
/** Bright cyan accent used for highlights/CTAs. */
173-
accent: "#00A8E8",
174-
/** White text/icons on accent. */
175-
accentInverted: "#FFFFFF",
159+
secondary: Colors.DARK_SLATE_GRAY, // used in secondary.main, text.secondary, borders
160+
secondaryInverted: Colors.charcoal[100], // for text on secondary-colored backgrounds
176161

177-
/** Light UI surface (DO uses a clean white background in light mode). */
178-
background: "#FFFFFF",
179-
/** Default content color (deep navy used across DO’s UI/text). */
180-
foreground: "#031B4E",
162+
accent: Colors.saffron[40], // from background.cta.default
163+
accentInverted: Colors.charcoal[100], // text on accent
181164

182-
// @deprecated same as primary
183-
default: "#0069FF",
184-
// @deprecated same as secondary
185-
hover: "#2E384D"
165+
background: Colors.charcoal[10], // app background, cards, tabs
166+
foreground: Colors.charcoal[100] // primary text color on background
186167
};
187168

188-
export const createCustomTheme = (mode: PaletteMode, primitives: PrimitivePalette = SistentDefaultPrimitivePalette) => {
169+
export const createCustomTheme = (mode: PaletteMode, primitives?: PrimitivePalette) => {
189170
const basePalette = mode == 'light' ? lightModePalette : darkModePalette;
190-
const p = SistentDefaultPrimitivePalette
171+
const defaultPrimitives = mode == 'light' ? SistentDefaultPrimitivePaletteLight : SistentDefaultPrimitivePaletteDark;
172+
const p = primitives ? _.merge({},defaultPrimitives , primitives, ) : undefined;
191173

192174
console.log('Creating theme with mode:', mode, 'and brandPalette:', primitives);
193175

@@ -199,6 +181,7 @@ export const createCustomTheme = (mode: PaletteMode, primitives: PrimitivePalett
199181
tertiary: darken(p.background, 0.1),
200182
elevated: p.background,
201183
overlay: alpha(p.background, 0.8),
184+
202185
tint: `linear-gradient(90deg, ${alpha(p.secondary,0.8)} 0%, ${p.secondary} 100%)`,
203186
inverse: p.foreground,
204187
},
@@ -213,7 +196,7 @@ export const createCustomTheme = (mode: PaletteMode, primitives: PrimitivePalett
213196
},
214197

215198
navigation: {
216-
primary: p.NavigationBar,
199+
primary: p.navigationBar,
217200
secondary: p.secondary,
218201
active: p.primary,
219202
hover: alpha(p.primary, 0.85),
@@ -271,7 +254,7 @@ export const createCustomTheme = (mode: PaletteMode, primitives: PrimitivePalett
271254

272255
surfaces: p.background,
273256

274-
appNavigationBar: p.NavigationBar,
257+
appNavigationBar: p.navigationBar,
275258
secondaryAppNavigationBar: p.secondary,
276259

277260
},

0 commit comments

Comments
 (0)