forked from mui/material-ui
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add
InitColorSchemeScript
for Next.js App Router (mui#42247)
- Loading branch information
1 parent
78731a4
commit 7240fca
Showing
32 changed files
with
249 additions
and
118 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
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
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
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
4 changes: 4 additions & 0 deletions
4
packages/mui-joy/src/InitColorSchemeScript/InitColorSchemeScript.spec.tsx
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,4 @@ | ||
import * as React from 'react'; | ||
import InitColorSchemeScript from '@mui/joy/InitColorSchemeScript'; | ||
|
||
<InitColorSchemeScript nonce="foo-bar" />; |
13 changes: 13 additions & 0 deletions
13
packages/mui-joy/src/InitColorSchemeScript/InitColorSchemeScript.test.tsx
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,13 @@ | ||
import * as React from 'react'; | ||
import { expect } from 'chai'; | ||
import { createRenderer } from '@mui/internal-test-utils'; | ||
import InitColorSchemeScript from '@mui/joy/InitColorSchemeScript'; | ||
|
||
describe('InitColorSchemeScript', () => { | ||
const { render } = createRenderer(); | ||
|
||
it('should render as expected', () => { | ||
const { container } = render(<InitColorSchemeScript />); | ||
expect(container.firstChild).to.have.tagName('script'); | ||
}); | ||
}); |
14 changes: 14 additions & 0 deletions
14
packages/mui-joy/src/InitColorSchemeScript/InitColorSchemeScript.tsx
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,14 @@ | ||
import * as React from 'react'; | ||
import SystemInitColorSchemeScript from '@mui/system/InitColorSchemeScript'; | ||
|
||
export const defaultConfig = { | ||
attribute: 'data-joy-color-scheme', | ||
colorSchemeStorageKey: 'joy-color-scheme', | ||
defaultLightColorScheme: 'light', | ||
defaultDarkColorScheme: 'dark', | ||
modeStorageKey: 'joy-mode', | ||
} as const; | ||
|
||
export default (function InitColorSchemeScript(props) { | ||
return <SystemInitColorSchemeScript {...defaultConfig} {...props} />; | ||
} as typeof SystemInitColorSchemeScript); |
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 @@ | ||
export { default } from './InitColorSchemeScript'; |
Oops, something went wrong.