hipstersmoothie / storybook-dark-mode

A storybook addon that lets your users toggle between dark and light mode.
MIT License
429 stars 56 forks source link

Add multiple classes? #219

Open chris-dura opened 1 year ago

chris-dura commented 1 year ago

Is there a way to add multiple classes?

darkMode: {
        current: "light",
        light: myThemeLight,
        dark: myThemeDark,
        lightClass: "my-theme my-theme--light",
        darkClass: "my-theme my-theme--dark",
        classTarget: "html",
        stylePreview: true,
    },

This gives an error:

ndors~main.f4a0d82e8f8bf122d552.manager.bundle.js:44 Uncaught DOMException: Failed to execute 'add' on 'DOMTokenList': The token provided ('my-theme my-theme--dark') contains HTML space characters, which are not valid in tokens.
    at toggleDarkClass (http://localhost:5280/vendors~main.f4a0d82e8f8bf122d552.manager.bundle.js:44:1698630)
    at updateManager (http://localhost:5280/vendors~main.f4a0d82e8f8bf122d552.manager.bundle.js:44:1699277)
    at Module.<anonymous> (http://localhost:5280/vendors~main.f4a0d82e8f8bf122d552.manager.bundle.js:44:1699871)
    at __webpack_require__ (http://localhost:5280/runtime~main.c35c46b9c170e8c7a963.manager.bundle.js:1:1301)
    at 494 (http://localhost:5280/main.d66d44eb2fd75c955afa.manager.bundle.js:1:531005)
    at __webpack_require__ (http://localhost:5280/runtime~main.c35c46b9c170e8c7a963.manager.bundle.js:1:1301)
    at checkDeferredModules (http://localhost:5280/runtime~main.c35c46b9c170e8c7a963.manager.bundle.js:1:957)
    at Array.webpackJsonpCallback [as push] (http://localhost:5280/runtime~main.c35c46b9c170e8c7a963.manager.bundle.js:1:645)
    at http://localhost:5280/main.d66d44eb2fd75c955afa.manager.bundle.js:1:47
t
hipstersmoothie commented 1 year ago

Doesn't seem like it! @chris-dura would you want to submit a pr to fix?