-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e3b357a
commit 2719445
Showing
18 changed files
with
71 additions
and
147 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,13 @@ | ||
'use client'; | ||
|
||
import { Theme } from '@/shared/types'; | ||
import { ThemeProvider } from 'next-themes'; | ||
import { ReactNode } from 'react'; | ||
|
||
export function ClientProviders({ children }: { children: ReactNode }) { | ||
// eslint-disable-next-line react/jsx-no-useless-fragment | ||
return <>{children}</>; | ||
return ( | ||
<ThemeProvider attribute='class' defaultTheme={Theme.DARK}> | ||
{children} | ||
</ThemeProvider> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,12 @@ | ||
import { ThemeProvider } from '@/app/providers/ThemeProvider'; | ||
import { NextIntlClientProvider, useMessages } from 'next-intl'; | ||
import { ReactNode } from 'react'; | ||
|
||
export function ServerProviders({ children }: { children: ReactNode }) { | ||
const messages = useMessages(); | ||
|
||
return ( | ||
<ThemeProvider> | ||
<NextIntlClientProvider messages={messages}> | ||
{children} | ||
</NextIntlClientProvider> | ||
</ThemeProvider> | ||
<NextIntlClientProvider messages={messages}> | ||
{children} | ||
</NextIntlClientProvider> | ||
); | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,26 @@ | ||
'use client'; | ||
|
||
import { Theme, useTheme } from '@/app/providers/ThemeProvider'; | ||
import DarkIcon from 'public/images/icons/theme-dark.svg'; | ||
import LightIcon from 'public/images/icons/theme-light.svg'; | ||
import { Theme } from '@/shared/types'; | ||
import { Button } from '@/shared/ui/Button'; | ||
import { useTheme } from 'next-themes'; | ||
import Moon from 'public/images/icons/moon.svg'; | ||
import { memo } from 'react'; | ||
|
||
interface ThemeSwitcherProps { | ||
className?: string; | ||
} | ||
|
||
export const ThemeSwitcher = memo(({ className }: ThemeSwitcherProps) => { | ||
const { theme, toggleTheme } = useTheme(); | ||
const { theme, setTheme } = useTheme(); | ||
|
||
const toggleTheme = () => { | ||
const newTheme = theme === Theme.DARK ? Theme.LIGHT : Theme.DARK; | ||
setTheme(newTheme); | ||
}; | ||
|
||
return ( | ||
<button type='button' onClick={toggleTheme} className={className}> | ||
{theme === Theme.DARK ? <DarkIcon /> : <LightIcon />} | ||
</button> | ||
<Button slice onClick={toggleTheme} className={className}> | ||
<Moon /> | ||
</Button> | ||
); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,8 @@ | ||
export type Size = 'none' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'full'; | ||
|
||
export type clsxMods = Record<string, boolean | string | undefined>; | ||
|
||
export enum Theme { | ||
LIGHT = 'light', | ||
DARK = 'dark', | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,4 +5,5 @@ module.exports = { | |
extend: {}, | ||
}, | ||
plugins: [], | ||
darkMode: 'class', | ||
}; |