16 lines
394 B
TypeScript
16 lines
394 B
TypeScript
import { useContext } from 'react';
|
|||
|
|
|
||
|
|
import { ThemeSystemContext } from './theme-system-context';
|
||
|
|
|
||
|
|
export function useThemeSystem() {
|
||
|
|
const context = useContext(ThemeSystemContext);
|
||
|
|
if (!context) {
|
||
|
|
throw new Error('useThemeSystem must be used within a ThemeSystemProvider');
|
||
|
|
}
|
||
|
|
return context;
|
||
|
|
}
|
||
|
|
|
||
|
|
export function useOptionalThemeSystem() {
|
||
|
|
return useContext(ThemeSystemContext);
|
||
|
|
}
|