-
-
Notifications
You must be signed in to change notification settings - Fork 181
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -48,17 +48,17 @@ const Theme = ({ | |
resolved = getSystemTheme() | ||
} | ||
|
||
const name = value ? value[resolved] : resolved | ||
const names = value ? Array.isArray(value[resolved]) ? value[resolved] : [value[resolved]] : resolved | ||
const enable = disableTransitionOnChange ? disableAnimation() : null | ||
const d = document.documentElement | ||
|
||
const handleAttribute = (attr: Attribute) => { | ||
if (attr === 'class') { | ||
d.classList.remove(...attrs) | ||
if (name) d.classList.add(name) | ||
if (names) d.classList.add(...names) | ||
} else if (attr.startsWith('data-')) { | ||
if (name) { | ||
d.setAttribute(attr, name) | ||
if (names) { | ||
d.setAttribute(attr, names.join(' ')) | ||
Check failure on line 61 in next-themes/src/index.tsx GitHub Actions / Run Unit Tests__tests__/index.test.tsx > defaultTheme > should return system-theme when no default-theme is set
Check failure on line 61 in next-themes/src/index.tsx GitHub Actions / Run Unit Tests__tests__/index.test.tsx > defaultTheme > should return light when no default-theme is set and enableSystem=false
Check failure on line 61 in next-themes/src/index.tsx GitHub Actions / Run Unit Tests__tests__/index.test.tsx > defaultTheme > should return light when light is set as default-theme
Check failure on line 61 in next-themes/src/index.tsx GitHub Actions / Run Unit Tests__tests__/index.test.tsx > defaultTheme > should return dark when dark is set as default-theme
Check failure on line 61 in next-themes/src/index.tsx GitHub Actions / Run Unit Tests__tests__/index.test.tsx > provider > ignores nested ThemeProviders
Check failure on line 61 in next-themes/src/index.tsx GitHub Actions / Run Unit Tests__tests__/index.test.tsx > storage > should not set localStorage with default value
Check failure on line 61 in next-themes/src/index.tsx GitHub Actions / Run Unit Tests__tests__/index.test.tsx > storage > should set localStorage when switching themes
Check failure on line 61 in next-themes/src/index.tsx GitHub Actions / Run Unit Tests__tests__/index.test.tsx > custom storageKey > should save to localStorage with 'theme' key when using default settings
Check failure on line 61 in next-themes/src/index.tsx GitHub Actions / Run Unit Tests__tests__/index.test.tsx > custom storageKey > should save to localStorage with 'custom' when setting prop 'storageKey' to 'customKey'
|
||
} else { | ||
d.removeAttribute(attr) | ||
} | ||
|