-
Notifications
You must be signed in to change notification settings - Fork 97
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: useIsDarkMode의 초기값을 undefined로 설정 (#212)
* fix: isDarkMode의 초기값을 undefined로 설정 * chore : changeset 추가 * feat: ThemeMode 컴포넌트 수정 및 적용 * Delete .changeset/six-clocks-matter.md --------- Co-authored-by: 박찬혁 <[email protected]>
- Loading branch information
1 parent
6e2c8e1
commit 1b62156
Showing
5 changed files
with
87 additions
and
60 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
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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import React from 'react'; | ||
import { useIsDarkMode } from '@/hooks/use-is-dark-mode'; | ||
|
||
interface ThemeModeProps { | ||
children: (theme: 'dark' | 'light') => React.ReactNode; | ||
fallback?: React.ReactNode; | ||
} | ||
|
||
export function ThemeMode({ children, fallback = null }: ThemeModeProps) { | ||
const isDarkMode = useIsDarkMode(); | ||
|
||
if (isDarkMode == null) { | ||
return fallback; | ||
} | ||
|
||
return children(isDarkMode ? 'dark' : 'light'); | ||
} |
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