Initial commit: React frontend (SLP Software) + AIDLC workflow docs
Co-authored-by: Junie <junie@jetbrains.com>
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
/**
|
||||
* Theme values (BR-3: only 'red' and 'purple' are valid).
|
||||
* Actual token colors live in src/index.css (.theme-red / .theme-purple);
|
||||
* this module only owns the *selectable* theme identifiers and the
|
||||
* localStorage key used for persistence (BR-2).
|
||||
*/
|
||||
|
||||
export type ThemeName = 'red' | 'purple';
|
||||
|
||||
export const THEMES: ThemeName[] = ['red', 'purple'];
|
||||
|
||||
export const DEFAULT_THEME: ThemeName = 'red';
|
||||
|
||||
export const THEME_STORAGE_KEY = 'slp-software-theme';
|
||||
|
||||
/** BR-3: fall back to the default theme for anything that isn't a valid ThemeName. */
|
||||
export function isValidTheme(value: unknown): value is ThemeName {
|
||||
return value === 'red' || value === 'purple';
|
||||
}
|
||||
|
||||
export function resolveInitialTheme(storedValue: string | null): ThemeName {
|
||||
if (isValidTheme(storedValue)) {
|
||||
return storedValue;
|
||||
}
|
||||
return DEFAULT_THEME;
|
||||
}
|
||||
|
||||
export function themeClassName(theme: ThemeName): string {
|
||||
return `theme-${theme}`;
|
||||
}
|
||||
Reference in New Issue
Block a user