Skip to content

Commit

Permalink
fix: lowercase letter in constant
Browse files Browse the repository at this point in the history
  • Loading branch information
benjitrosch committed Mar 16, 2022
1 parent eac4776 commit 5949be7
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions .storybook/preview.tsx
Expand Up @@ -5,7 +5,7 @@ import React from 'react'
import StoryLayout from './story-layout'

import '../src/styles.css'
import { DEFAUlT_THEME, STORAGE_KEY, THEME_PICKER_LIST } from './theming'
import { DEFAULT_THEME, STORAGE_KEY, THEME_PICKER_LIST } from './theming'

export const parameters = {
actions: { argTypesRegex: '^on[A-Z].*' },
Expand Down Expand Up @@ -34,7 +34,7 @@ export const parameters = {
},
},
themes: {
default: window.localStorage.getItem(STORAGE_KEY) || DEFAUlT_THEME,
default: window.localStorage.getItem(STORAGE_KEY) || DEFAULT_THEME,
onChange: (theme) => {
// STORAGE_KEY does not work in onChange... not sure why
if (theme) {
Expand Down
2 changes: 1 addition & 1 deletion .storybook/theming/consts.ts
@@ -1,4 +1,4 @@
export const DEFAUlT_THEME = 'dark'
export const DEFAULT_THEME = 'dark'
export const STORAGE_KEY = 'sb-react-daisyui-preview-theme'

export const THEME_PICKER_LIST = [
Expand Down
6 changes: 3 additions & 3 deletions .storybook/theming/useGlobalTheme.ts
@@ -1,18 +1,18 @@
import React, { useEffect, useState } from 'react'

import { STORAGE_KEY, DEFAUlT_THEME } from '.'
import { STORAGE_KEY, DEFAULT_THEME } from '.'

export const useGlobalTheme = () => {
const [theme, setTheme] = useState(
window.localStorage.getItem(STORAGE_KEY) || DEFAUlT_THEME
window.localStorage.getItem(STORAGE_KEY) || DEFAULT_THEME
)

useEffect(() => {
const handleLocalStorageChange = () => {
let storageTheme = window.localStorage.getItem(STORAGE_KEY)

if (!storageTheme) {
setTheme(DEFAUlT_THEME)
setTheme(DEFAULT_THEME)
} else {
setTheme(storageTheme)
}
Expand Down

0 comments on commit 5949be7

Please sign in to comment.