Browse Source

Fix stylesheet toggle

Use rel attributes to specify currently selected theme.
tags/0.3.0
TheoryOfNekomata 4 years ago
parent
commit
48881294f8
1 changed files with 2 additions and 0 deletions
  1. +2
    -0
      packages/react-common-docs/src/components/ThemeToggle/ThemeToggle.tsx

+ 2
- 0
packages/react-common-docs/src/components/ThemeToggle/ThemeToggle.tsx View File

@@ -26,8 +26,10 @@ const applyStyles = (theme) => {
stylesheets.forEach(s => {
const enabled = s.title === theme
if (enabled) {
s.setAttribute('rel', 'stylesheet')
s.removeAttribute('disabled')
} else {
s.setAttribute('rel', 'alternate')
s.setAttribute('disabled', 'disabled')
}
})


Loading…
Cancel
Save