question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

vuejs addDecorator(withOptions({ name: 'bah', theme: { mainBackground: 'red' } })) does not change storybook page name or color

See original GitHub issue

Describe the bug using addDecorator(withOptions({ name: ‘bah’, theme: { mainBackground: ‘red’ } })) does not affect storybook pages using vuejs.

To Reproduce Steps to reproduce the behavior:

  1. Write the following to your vue project’s .storybook/config.js: addDecorator(withOptions({ name: 'bah', theme: { mainBackground: 'red' } }))
  2. run the storybook application and see the page with un-changed name and background.

Expected behavior the name and background should be changed

Screenshots screen shot 2018-11-15 at 12 30 16 pm

Code snippets .storybook/config.js

import { configure, addDecorator } from '@storybook/vue';
import { withOptions } from '@storybook/addon-options';
import { themes } from '@storybook/components';
import 'babel-polyfill';

// automatically import all files ending in *.stories.js
const req = require.context( '../stories', true, /.stories.js$/ );
function loadStories () {
    req.keys().forEach( filename => req( filename ) );
}

addDecorator(
    withOptions({
        name: 'bah',
        theme: {
            mainBackground: 'red'
        }
    })
);

configure( loadStories, module );

System:

  • OS: MacOS
  • Device: Macbook Pro 2016
  • Browser: Firefox (any)
  • Framework: vue
  • Addons: “@storybook/vue”: “^4.0.7”, “@storybook/addon-options”: “^4.0.7”
  • Version: “storybook”: “1.0.0”

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:10 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
Leessoncommented, Nov 20, 2018

Adding import '@storybook/addon-options/register' to .storybook/addons.js did fix this issue.

addons.js:

import '@storybook/addon-actions/register';
import '@storybook/addon-links/register';
import '@storybook/addon-options/register';

config.js:

import { configure, addDecorator } from '@storybook/vue';
import { withOptions } from '@storybook/addon-options';
import { themes } from '@storybook/components';
const { dark } = themes;

addDecorator(
  withOptions({
    theme: dark,
  })
);

// automatically import all files ending in *.stories.js
const req = require.context('../stories', true, /.stories.js$/);
function loadStories() {
  req.keys().forEach(filename => req(filename));
}

configure(loadStories, module);
0reactions
Keraitocommented, Nov 21, 2018

@iambumblehead Currently there are only those two pre-made themes, yes. But creating your own should not be too difficult.

the issue is, for me, resolved but I leave the status unchanged in case that is more polite.

If all your problems are resolved regarding the initial issue, then please feel free to close this issue 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

vuejs addDecorator(withOptions({ name: 'bah', theme ... - GitHub
Describe the bug using addDecorator(withOptions({ name: 'bah', theme: { mainBackground: 'red' } })) does not affect storybook pages using vuejs.
Read more >
How to add a theme switcher to Storybook - JS.ORG
This article shows you how. Use a decorator to pass the theme object to your components; Switch the theme dynamically from the toolbar...
Read more >
Setting up storybook with vuetify 2 - Stack Overflow
I've had troubles for a long time setting up vuetify 2.3.3 with Storybook 5.3.19. I'm not sure but it seemed that the vue-cli-plugins ......
Read more >
Top 5 @storybook/vue Code Examples - Snyk
Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues...
Read more >
Vue.js Development with Storybook and Applitools
At one point in time, the server-side code was responsible for generating and serving every page in our application. Nowadays, Single Page ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found