Skip to content

Commit

Permalink
rename dark to darkMode and light to lightMode
Browse files Browse the repository at this point in the history
  • Loading branch information
ben-rogerson committed Nov 20, 2020
1 parent 8abbd36 commit d3113de
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
16 changes: 8 additions & 8 deletions src/config/variantConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,11 @@ export default {
// Class strategy: In your tailwind.config.js, add `{ dark: 'class' }
// then add a `className="dark"` on a parent element.
class: !hasGroupVariant && '.dark &',
}[config('dark') || 'media'] || null
}[config('darkMode') || 'media'] || null

if (!styles && !hasGroupVariant) {
errorCustom(
"The `dark` config option must be either `{ dark: 'media' }` (default) or `{ dark: 'class' }`"
"The `darkMode` config option must be either `{ darkMode: 'media' }` (default) or `{ darkMode: 'class' }`"
)
}

Expand All @@ -108,17 +108,17 @@ export default {
// Class strategy: In your tailwind.config.js, add `{ light: 'class' }
// then add a `className="light"` on a parent element.
class: !hasGroupVariant && '.light &',
}[config('light') || config('dark') || 'media'] || null
}[config('lightMode') || config('darkMode') || 'media'] || null

if (!styles && !hasGroupVariant) {
if (config('light')) {
if (config('lightMode')) {
errorCustom(
"The `light` config option must be either `{ light: 'media' }` (default) or `{ light: 'class' }`"
"The `lightMode` config option must be either `{ lightMode: 'media' }` (default) or `{ lightMode: 'class' }`"
)
}

errorCustom(
"The `dark` config option must be either `{ dark: 'media' }` (default) or `{ dark: 'class' }`"
"The `darkMode` config option must be either `{ darkMode: 'media' }` (default) or `{ darkMode: 'class' }`"
)
}

Expand All @@ -131,9 +131,9 @@ const generateGroupSelector = (
{ hasDarkVariant, hasLightVariant, config }
) => {
const themeVariant =
(hasDarkVariant && config('dark') === 'class' && ['dark ', 'dark']) ||
(hasDarkVariant && config('darkMode') === 'class' && ['dark ', 'dark']) ||
(hasLightVariant &&
(config('light') === 'class' || config('dark') === 'class') && [
(config('lightMode') === 'class' || config('darkMode') === 'class') && [
'light ',
'light',
])
Expand Down
2 changes: 1 addition & 1 deletion tailwind.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ const textStyles = theme => ({
})

module.exports = {
dark: 'class',
darkMode: 'media',
theme: {
container: {
padding: {
Expand Down

0 comments on commit d3113de

Please sign in to comment.