-
-
Notifications
You must be signed in to change notification settings - Fork 2
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
Not showing badges in sidebar #15
Comments
Check in |
I'm using only the ones set by storybook vite/ts template, and moving addons: [
getAbsolutePath('storybook-addon-tag-badges'),
getAbsolutePath('@storybook/addon-onboarding'),
getAbsolutePath('@storybook/addon-links'),
getAbsolutePath('@storybook/addon-essentials'),
getAbsolutePath('@storybook/addon-interactions'),
getAbsolutePath('@storybook/addon-themes'),
], |
I had the same issue. I noticed that when removing my sidebar filters in manager.ts, it did show up. I have a sidebar filter in manager.ts so it won't display my stories with tag 'chromatic-only' manager.ts addons.setConfig({
sidebar: {
filters: {
patterns: (item) => {
// in the sidebar exclude all items with the tag 'chromatic-only'
return !item.tags?.includes('chromatic-only');
},
},
},
}); |
Hi @equinusocio, thanks for the report. Not all tags appear in the sidebar. What goes in the sidebar is controlled by the Also, when a badge is displayed only for a component entry, the tag must actually be defined on the component (in the Could you please share your |
FYI I address this situation in https://github.com/Sidnioulz/storybook-addon-tag-badges?tab=readme-ov-file#sidebar-label-customisations. There are a few options to make this addon co-exist with other customisations. Curious to have your feedback on it. |
@Fedduh I've created separate issues for your own reports, thanks for taking the time to share. Please check them out and add a MWE if possible to help me go through them faster! |
Our import { addons } from '@storybook/manager-api';
import { themes } from '@storybook/theming';
import lualtekTheme from './lualtek-theme';
addons.setConfig({
theme: { ...themes.dark, ...lualtekTheme },
sidebar: {
showRoots: true,
},
}); We removed the addon since it doesn't work with a basic storybook boilerplate either. |
What version of Storybook are you on? Are you able to share a repo?
…On Mon, 18 Nov 2024, 17:56 Mattia Astorino, ***@***.***> wrote:
Our manager.ts is pretty simple
import { addons } from ***@***.***/manager-api';import { themes } from ***@***.***/theming';
import lualtekTheme from './lualtek-theme';
addons.setConfig({
theme: { ...themes.dark, ...lualtekTheme },
sidebar: {
showRoots: true,
},});
We removed the addon since it doesn't work with a basic storybook
boilerplate either.
—
Reply to this email directly, view it on GitHub
<#15 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABG7GYJZECUR4YZ3QXQZ4WD2BIL3VAVCNFSM6AAAAABRYVS5A6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDIOBTGU4TKOJSHE>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
Storybook 8.4.4, the repo is private, unfortunately, but we just setup their storybook |
@equinusocio I've just set up a Storybook 8.4.4 React+Vite+TS repo, installed storybook-addon-tag-badges 1.2.0, added it to There is something about your setup that you haven't shared yet and that is interfering. Wanna hop onto a call and show me? |
My repo is not public i can't share a link, but I can share my storybook config files: preview.ts import '@lualtek/themes/web';
import '../packages/react-components/src/core.css';
import './overrides.css';
import { withThemeByDataAttribute } from '@storybook/addon-themes';
import type { ReactRenderer } from '@storybook/react';
import { Preview } from '@storybook/react';
import { themes } from '@storybook/theming';
import lualtekTheme from './lualtek-theme';
const preview: Preview = {
decorators: [
withThemeByDataAttribute<ReactRenderer>({
themes: {
auto: 'auto',
light: 'light',
dark: 'dark',
},
defaultTheme: 'dark',
}),
],
parameters: {
backgrounds: { disable: true },
docs: {
theme: { ...themes.dark, ...lualtekTheme },
},
controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/i,
},
},
},
};
export default preview; manager.ts import { addons } from '@storybook/manager-api';
import { themes } from '@storybook/theming';
import lualtekTheme from './lualtek-theme';
addons.setConfig({
theme: { ...themes.dark, ...lualtekTheme },
sidebar: {
showRoots: true,
},
}); main.ts /* eslint-disable no-param-reassign */
import { dirname, join, resolve } from 'node:path';
import type { StorybookConfig } from '@storybook/react-vite';
/**
* This function is used to resolve the absolute path of a package.
* It is needed in projects that use Yarn PnP or are set up within a monorepo.
*/
function getAbsolutePath(value: string): string {
return dirname(require.resolve(join(value, 'package.json')));
}
const config: StorybookConfig = {
stories: ['../packages/**/src/**/*.stories.@(js|jsx|ts|tsx)'],
addons: [
getAbsolutePath('@storybook/addon-onboarding'),
getAbsolutePath('@storybook/addon-links'),
getAbsolutePath('@storybook/addon-essentials'),
getAbsolutePath('@storybook/addon-interactions'),
getAbsolutePath('@storybook/addon-themes'),
],
framework: {
name: getAbsolutePath('@storybook/react-vite'),
options: {},
},
docs: {
autodocs: true,
},
typescript: {
check: false,
reactDocgen: 'react-docgen-typescript',
reactDocgenTypescriptOptions: {
shouldExtractLiteralValuesFromEnum: true,
propFilter: prop => (prop.parent ? !prop.parent.fileName.includes('node_modules') : true),
},
},
viteFinal: async (config) => {
if (config && config.resolve && config.resolve.alias) {
config.resolve.alias['@/components'] = resolve(__dirname, '../packages/react-components/src');
config.resolve.alias['@/charts'] = resolve(__dirname, '../packages/charts/src');
return config;
}
return config;
},
};
export default config; |
@equinusocio try that instead? // .storybook/manager.ts
import { addons } from '@storybook/manager-api';
import { themes } from '@storybook/theming';
import { renderLabel } from 'storybook-addon-tag-badges'
import lualtekTheme from './lualtek-theme';
addons.setConfig({
theme: { ...themes.dark, ...lualtekTheme },
sidebar: {
renderLabel,
showRoots: true,
},
}); |
RE: the ESLint error, I don't have it locally (no unsafe assignment reported), so I'd love to see what the exact error message is, maybe alongside your tsconfig and eslint config? This isn't a bug in this addon. It's a general limitation of |
Ok thanks! Can you mention this in the doc/readme to avoid future similar issues? |
Thanks for bringing this up @equinusocio. I did add README doc since you opened that issue, but I'll develop it further the next time the issue comes up. |
I don't get why we need to use |
There could be a bug in https://github.com/storybookjs/storybook/blob/next/code/core/src/manager-api/modules/layout.ts#L391 where addon-injected changes aren't part of the initial store state and some data gets erased through I'll ask around. |
Story
The badge appears only in the toolbar, even if both component and story have the tag. Already tried to put the tag on component only, and story only. Storybook 8.4.3
The text was updated successfully, but these errors were encountered: