Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: rename use theme key and update type #628

Merged
merged 2 commits into from
Oct 9, 2024

Conversation

yue4u
Copy link
Contributor

@yue4u yue4u commented Oct 4, 2024

やったこと

  • rename useTheme parama from key to localstorageKey
  • modify theme type to be "light" | "dark" | undefined

動作確認環境

チェックリスト

不要なチェック項目は消して構いません

  • 破壊的変更がある場合には、対象のパッケージのメジャーバージョンが上がっていることを確認した
  • 追加したコンポーネントが index.ts から再 export されている
  • README やドキュメントに影響があることを確認した

const isDark = useMedia('(prefers-color-scheme: dark)')
const media = isDark !== undefined ? (isDark ? 'dark' : 'light') : undefined
const [local, setTheme, ready] = useLocalStorage<string>(key)
const [local, setTheme, ready] = useLocalStorage<typeof media>(localStorageKey)
Copy link
Contributor Author

@yue4u yue4u Oct 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question: does charcoal allow theme is not "light" | "dark" | undefined?

Changing return type should be breaking but if we never allowed custom string this should be a minor change.

@yue4u yue4u added the minor label Oct 4, 2024
@yue4u yue4u merged commit dd69f2d into pixiv:main Oct 9, 2024
10 checks passed
@yue4u yue4u deleted the fix/rename-use-theme-key-and-update-type branch October 9, 2024 07:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants