Merge branch 'main' of github.com:nextui-org/nextui into feat/new-lading-page

This commit is contained in:
Junior García 2022-01-16 15:15:11 -03:00
commit 7b4a45dc63
4 changed files with 6 additions and 4 deletions

View File

@ -41,6 +41,7 @@ import { ThemeProvider as NextThemesProvider } from 'next-themes';
// 2. Call `createTheme` and pass your custom values // 2. Call `createTheme` and pass your custom values
const lightTheme = createTheme({ const lightTheme = createTheme({
type: 'light', type: 'light',
className: 'light', // customize the class that enables this theme, `light-theme` by default
theme: { theme: {
colors: {...}, colors: {...},
} }
@ -48,6 +49,7 @@ const lightTheme = createTheme({
const darkTheme = createTheme({ const darkTheme = createTheme({
type: 'dark', type: 'dark',
className: 'dark', // customize the class that enables this theme, `dark-theme` by default
theme: { theme: {
colors: {...}, colors: {...},
} }

View File

@ -43,11 +43,10 @@ npm i @nextui-org/react
Go to the root of your application and do this: Go to the root of your application and do this:
```jsx ```jsx
import { CssBaseline, NextUIProvider } from '@nextui-org/react'; import { NextUIProvider } from '@nextui-org/react';
const Application = () => ( const Application = () => (
<NextUIProvider> <NextUIProvider>
<CssBaseline /> // ---> Normalize styles
<AppComponent /> // ---> Your App Component <AppComponent /> // ---> Your App Component
</NextUIProvider> </NextUIProvider>
); );

View File

@ -60,12 +60,12 @@ export const sharedVisuallyHidden = css({
position: 'absolute' position: 'absolute'
}); });
export const createTheme = ({ type, theme }: Theme) => { export const createTheme = ({ type, theme, className }: Theme) => {
if (!type) { if (!type) {
throw new Error('Theme type is required'); throw new Error('Theme type is required');
} }
return createThemeBase( return createThemeBase(
`${type}-theme`, className || `${type}-theme`,
deepMerge(type === 'dark' ? darkTheme : lightTheme, theme) deepMerge(type === 'dark' ? darkTheme : lightTheme, theme)
); );
}; };

View File

@ -47,6 +47,7 @@ export interface TokenValue {
export type Theme = { export type Theme = {
type?: ThemeType | string; type?: ThemeType | string;
className?: string;
theme?: BaseTheme; theme?: BaseTheme;
}; };