fix : Pas besoin de theming
This commit is contained in:
@@ -1,24 +0,0 @@
|
||||
import { type PropsWithChildren, useMemo } from 'react';
|
||||
|
||||
import { colors, glow, gradientDirection, gradients, palette } from './colors';
|
||||
import spacing, { borderRadius } from './spacing';
|
||||
import typography from './typography';
|
||||
import { ThemeContext } from './useTheme';
|
||||
|
||||
export function ThemeProvider({ children }: PropsWithChildren) {
|
||||
const value = useMemo(
|
||||
() => ({
|
||||
colors,
|
||||
gradients,
|
||||
glow,
|
||||
gradientDirection,
|
||||
palette,
|
||||
typography,
|
||||
spacing,
|
||||
borderRadius,
|
||||
}),
|
||||
[],
|
||||
);
|
||||
|
||||
return <ThemeContext.Provider value={value}>{children}</ThemeContext.Provider>;
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
import { createContext, useContext } from 'react';
|
||||
|
||||
import { colors, glow, gradientDirection, gradients, palette } from './colors';
|
||||
import spacing, { borderRadius } from './spacing';
|
||||
import typography from './typography';
|
||||
|
||||
export type ThemeContextValue = {
|
||||
colors: typeof colors;
|
||||
gradients: typeof gradients;
|
||||
glow: typeof glow;
|
||||
gradientDirection: typeof gradientDirection;
|
||||
palette: typeof palette;
|
||||
typography: typeof typography;
|
||||
spacing: typeof spacing;
|
||||
borderRadius: typeof borderRadius;
|
||||
};
|
||||
|
||||
export const ThemeContext = createContext<ThemeContextValue | undefined>(undefined);
|
||||
|
||||
export const useTheme = () => {
|
||||
const context = useContext(ThemeContext);
|
||||
|
||||
if (!context) {
|
||||
throw new Error('useTheme must be used within a ThemeProvider');
|
||||
}
|
||||
|
||||
return context;
|
||||
};
|
||||
Reference in New Issue
Block a user