Refactor color selection to use context and extract assignation function

This commit is contained in:
Calli
2023-10-06 17:48:23 +03:00
parent 53c57a0383
commit 75b9eb8be1
6 changed files with 162 additions and 43 deletions

View File

@@ -36,4 +36,26 @@ export const SessionContext = createContext<{
planMode: false,
togglePlanMode: () => {},
piPrices: undefined,
})
export type ColorContextType = {
defaultColor: string;
expiredColor: string;
twoHoursColor: string;
fourHoursColor: string;
eightHoursColor: string;
twelveHoursColor: string;
dayColor: string;
twoDaysColor: string;
}
export const ColorContext = createContext<ColorContextType>({
defaultColor: '#006596',
expiredColor: '#AB324A',
twoHoursColor: '#9C4438',
fourHoursColor: '#765B21',
eightHoursColor: '#63620D',
twelveHoursColor: '#2C6C2F',
dayColor: '#2F695A',
twoDaysColor: '#2F695A',
});