Skip to content

Commit

Permalink
feat(useColorMode): disableTransition support pseudo-elements
Browse files Browse the repository at this point in the history
  • Loading branch information
lainbo committed May 31, 2023
1 parent b7b985b commit af367dc
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion packages/core/useColorMode/index.ts
Expand Up @@ -156,7 +156,18 @@ export function useColorMode<T extends string = BasicColorMode>(
let style: HTMLStyleElement | undefined
if (disableTransition) {
style = window!.document.createElement('style')
style.appendChild(document.createTextNode('*{-webkit-transition:none!important;-moz-transition:none!important;-o-transition:none!important;-ms-transition:none!important;transition:none!important}'))
const styleString = `
*,
*::before,
*::after {
-webkit-transition: none !important;
-moz-transition: none !important;
-o-transition: none !important;
-ms-transition: none !important;
transition: none !important;
}
`
style.appendChild(document.createTextNode(styleString))
window!.document.head.appendChild(style)
}

Expand Down

0 comments on commit af367dc

Please sign in to comment.