paradiego
This commit is contained in:
+6
@@ -0,0 +1,6 @@
|
||||
import * as React from 'react';
|
||||
const ThemeContext = /*#__PURE__*/React.createContext(null);
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
ThemeContext.displayName = 'ThemeContext';
|
||||
}
|
||||
export default ThemeContext;
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
export { default } from './useTheme';
|
||||
export * from './useTheme';
|
||||
+1
@@ -0,0 +1 @@
|
||||
export { default } from "./useTheme.js";
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"sideEffects": false,
|
||||
"module": "./index.js",
|
||||
"main": "../node/useTheme/index.js",
|
||||
"types": "./index.d.ts"
|
||||
}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
import { DefaultTheme } from '../defaultTheme';
|
||||
|
||||
export default function useTheme<T = DefaultTheme>(): T;
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
import * as React from 'react';
|
||||
import ThemeContext from "./ThemeContext.js";
|
||||
export default function useTheme() {
|
||||
const theme = React.useContext(ThemeContext);
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
// TODO: uncomment once we enable eslint-plugin-react-compiler eslint-disable-next-line react-compiler/react-compiler
|
||||
// eslint-disable-next-line react-hooks/rules-of-hooks -- It's not required to run React.useDebugValue in production
|
||||
React.useDebugValue(theme);
|
||||
}
|
||||
return theme;
|
||||
}
|
||||
Reference in New Issue
Block a user