Skip to content

Commit

Permalink
feat: add orange theme
Browse files Browse the repository at this point in the history
  • Loading branch information
TomatoVan committed Dec 16, 2023
1 parent 282297e commit a60654e
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/app/providers/ThemeProvider/lib/ThemeContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { createContext } from 'react';
export enum Theme {
LIGHT = 'app_light_theme',
DARK = 'app_dark_theme',
ORANGE = 'app_orange_theme'
}

export interface ThemeContextProps {
Expand Down
16 changes: 15 additions & 1 deletion src/app/providers/ThemeProvider/lib/useTheme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,21 @@ export function useTheme(): UseThemeResult {
const { theme, setTheme } = useContext(ThemeContext);

const toggleTheme = () => {
const newTheme = theme === Theme.DARK ? Theme.LIGHT : Theme.DARK;
let newTheme: Theme;
switch (theme) {
case Theme.DARK:
newTheme = Theme.LIGHT;
break;
case Theme.LIGHT:
newTheme = Theme.ORANGE;
break;
case Theme.ORANGE:
newTheme = Theme.DARK;
break;
default:
newTheme = Theme.LIGHT;
}

setTheme?.(newTheme);
// чтобы работали стили в модалках и других частях приложения (используется по умолчанию везде как единая точка входа)
document.body.className = newTheme;
Expand Down
7 changes: 4 additions & 3 deletions src/app/styles/index.scss
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
@import "reset";
@import "variables/global";
@import "themes/normal";
@import "themes/dark";
@import "./variables/global";
@import "./themes/normal";
@import "./themes/dark";
@import "./themes/orange";

body {
font: var(--font-m);
Expand Down
8 changes: 8 additions & 0 deletions src/app/styles/themes/orange.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.app_orange_theme {
--bg-color: #faf4fb;
--inverted-bg-color: #bd5012;
--primary-color: #9a1a0e;
--secondary-color: #d01f0e;
--inverted-primary-color: #dbd5dc;
--inverted-secondary-color: #faf4fb;
}

0 comments on commit a60654e

Please sign in to comment.