-
Notifications
You must be signed in to change notification settings - Fork 58
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
Custom Port seems to break this addon? #255
Comments
Could you take a stab at a PR? |
Although my error is not exactly the same as the original issuer, it appears to be coming from the same place. I found that my error is coming from the Tool.jsx file, specifically the toggleDarkClass function. Following the stack trace, it appears to start from the initialization of Tool.jsx, where the This is what the local storage is returning for me: // window.localStorage["sb-addon-themes-3"]
{
"classTarget": "html",
"dark": {
"base": "dark",
"colorPrimary": "#FF4785",
"colorSecondary": "#029CFD",
"appBg": "#222425",
"appContentBg": "#1B1C1D",
"appPreviewBg": "#FFFFFF",
"appBorderColor": "rgba(255,255,255,.1)",
"appBorderRadius": 4,
"fontBase": "\"Nunito Sans\", -apple-system, \".SFNSText-Regular\", \"San Francisco\", BlinkMacSystemFont, \"Segoe UI\", \"Helvetica Neue\", Helvetica, Arial, sans-serif",
"fontCode": "ui-monospace, Menlo, Monaco, \"Roboto Mono\", \"Oxygen Mono\", \"Ubuntu Monospace\", \"Source Code Pro\", \"Droid Sans Mono\", \"Courier New\", monospace",
"textColor": "#C9CDCF",
"textInverseColor": "#222425",
"textMutedColor": "#798186",
"barTextColor": "#798186",
"barHoverColor": "#029CFD",
"barSelectedColor": "#029CFD",
"barBg": "#292C2E",
"buttonBg": "#222425",
"buttonBorder": "rgba(255,255,255,.1)",
"booleanBg": "#222425",
"booleanSelectedBg": "#2E3438",
"inputBg": "#1B1C1D",
"inputBorder": "rgba(255,255,255,.1)",
"inputTextColor": "#FFFFFF",
"inputBorderRadius": 4
},
"darkClass": "dark",
"light": {
"base": "light",
"colorPrimary": "#FF4785",
"colorSecondary": "#029CFD",
"appBg": "#F6F9FC",
"appContentBg": "#FFFFFF",
"appPreviewBg": "#FFFFFF",
"appBorderColor": "hsla(203, 50%, 30%, 0.15)",
"appBorderRadius": 4,
"fontBase": "\"Nunito Sans\", -apple-system, \".SFNSText-Regular\", \"San Francisco\", BlinkMacSystemFont, \"Segoe UI\", \"Helvetica Neue\", Helvetica, Arial, sans-serif",
"fontCode": "ui-monospace, Menlo, Monaco, \"Roboto Mono\", \"Oxygen Mono\", \"Ubuntu Monospace\", \"Source Code Pro\", \"Droid Sans Mono\", \"Courier New\", monospace",
"textColor": "#2E3438",
"textInverseColor": "#FFFFFF",
"textMutedColor": "#5C6870",
"barTextColor": "#73828C",
"barHoverColor": "#029CFD",
"barSelectedColor": "#029CFD",
"barBg": "#FFFFFF",
"buttonBg": "#F6F9FC",
"buttonBorder": "#D9E8F2",
"booleanBg": "#ECF4F9",
"booleanSelectedBg": "#FFFFFF",
"inputBg": "#FFFFFF",
"inputBorder": "hsla(203, 50%, 30%, 0.15)",
"inputTextColor": "#2E3438",
"inputBorderRadius": 4
},
"lightClass": "", // <-- Breaking issue
"stylePreview": true,
"userHasExplicitlySetTheTheme": true,
"current": "light"
} This is my // .storybook/preview.ts
import type { Preview } from "@storybook/react";
export default {
parameters: {
actions: { argTypesRegex: "^on[A-Z].*" },
controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/i
}
},
darkMode: {
classTarget: "html",
darkClass: "dark",
lightClass: "light",
stylePreview: true
}
}
} as Preview; |
I unfortunately don't have any experience with the Storybook extensions API and I'm not sure how to start investigating this further. I basically came to the same outcome as @AGS1130 did, which is that the darkMode: {
classTarget: 'html',
darkClass: 'theme-dark',
lightClass: 'theme-light',
stylePreview: true,
}, But after forking/linking the repo and trying to investigate it locally, the Which is particularly strange given that the |
Okay, I think I figured it out. If the Not sure how you want to handle this @hipstersmoothie, but we can probably close this out? |
This is a bit of a strange one, but it appears that for some reason this addon breaks when you try to use a custom port with the following error:
Sample repo is here: https://github.com/K3TH3R/storybook-dark-mode-issue
If you just clone the repo, and then run
npm run storybook
, everything works fine. If you runnpm run storybook-fail
, you'll see the error in the console. The only difference between these two package.json scripts is the usage of a port that isn't the standard6006
port.The text was updated successfully, but these errors were encountered: