Skip to content

Commit

Permalink
rename variable and improve typing on theme
Browse files Browse the repository at this point in the history
  • Loading branch information
MonPote committed Dec 8, 2023
1 parent 2b9830d commit 71dcdb6
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 9 deletions.
20 changes: 15 additions & 5 deletions src/lib/style/theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,9 @@ export type CoreUITheme = {
textReverse: string;
textLink: string;
};
type ThemeName = 'darkRebrand' | 'ring9dark';
export const defaultTheme: Record<ThemeName, CoreUITheme> = {
export type CoreUIThemeName = 'darkRebrand' | 'ring9dark';

export const coreUIAvailableThemes: Record<CoreUIThemeName, CoreUITheme> = {
darkRebrand: {
statusHealthy: '#0AADA6',
statusHealthyRGB: '10,173,166',
Expand Down Expand Up @@ -83,11 +84,11 @@ export const defaultTheme: Record<ThemeName, CoreUITheme> = {
},
ring9dark: {
statusHealthy: '#2BAB51',
statusHealthyRGB: '43, 171, 81',
statusHealthyRGB: '43,171,81',
statusWarning: '#FC8A32',
statusWarningRGB: '252, 138, 50',
statusWarningRGB: '252,138,50',
statusCritical: '#E84855',
statusCriticalRGB: '232, 72, 85, 1',
statusCriticalRGB: '232,72,85,1',
selectedActive: '#2196F3',
highlight: '#1A3C75',
border: '#313131',
Expand All @@ -108,6 +109,15 @@ export const defaultTheme: Record<ThemeName, CoreUITheme> = {
},
};

/**
* @deprecated
*
* Please use coreUIAvailableThemes instead, the label is more explicit.
*
* import { coreUIAvailableThemes } from '@scality/core-ui/dist/style/theme';
*/
export const defaultTheme = coreUIAvailableThemes;

export const brand = defaultTheme.darkRebrand;
export type ThemeColors = keyof CoreUITheme;
// LineChart colors
Expand Down
6 changes: 2 additions & 4 deletions types/styled.d.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import 'styled-components';
import { defaultTheme } from '../src/lib/style/theme';

type Theme = typeof defaultTheme.darkRebrand;
import { CoreUITheme } from '../src/lib/style/theme';

declare module 'styled-components' {
export interface DefaultTheme extends Theme {}
export interface DefaultTheme extends CoreUITheme {}
}

0 comments on commit 71dcdb6

Please sign in to comment.