-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: theme, useTheme export문 추가 (#30)
* feat: theme export문 추가 * 0.1.1 * chore: tsconfig 설정 수정 * 0.1.2 * chore: tsconfig 설정 수정 * 0.1.3 * chore: styled.d.ts 파일 src로 이동 * 0.1.4 * feat: useTheme 훅 추가 * feat: useTheme export 추가 * 0.1.5 * feat: theme 타입 설정 * 0.1.6 --------- Co-authored-by: Leejin-Yang <ejin1996@gmail.com>
- Loading branch information
1 parent
57afd4c
commit c8f6c91
Showing
6 changed files
with
26 additions
and
8 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { useContext } from 'react'; | ||
import { ThemeContext } from 'styled-components'; | ||
|
||
import type { Theme } from '../styles/theme'; | ||
|
||
const useTheme = () => { | ||
const theme = useContext(ThemeContext); | ||
|
||
if (!theme) { | ||
throw new Error('theme을 사용하려면 App을 FunEatProvider로 감싸주세요.'); | ||
} | ||
|
||
return theme as Theme; | ||
}; | ||
|
||
export default useTheme; |
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