Lullabot / storybook-drupal-addon

Storybook addon to facilitate integrating Storybook with Drupal projects.
MIT License
39 stars 7 forks source link

Drupal theme dropdown not working #24

Closed cluke009 closed 1 year ago

cluke009 commented 1 year ago

I have a similar issue to this one: https://github.com/Lullabot/storybook-drupal-addon/issues/12

It seems the only issue is with "supportedDrupalThemes" not populating the storybook dropdown though.

The error in the dropdown is "No themes in parameters".

If I change the "drupalTheme" to be bartik for instance it will actually update storybook and pull the css and js from the correct theme. There is just no way to change the theme without editing the preview.js file.

The CL Example Components are getting loaded as expected and the correct frontend files are pulled but with the dropdown not populating its not exactly clear things are actually working.

main.js

module.exports = {
  "stories": [
    "../web/themes/**/*.stories.mdx",
    "../web/themes/**/*.stories.@(json|yml)",
    "../web/modules/**/*.stories.mdx",
    "../web/modules/**/*.stories.@(json|yml)",
  ],
  "addons": [
    "@storybook/addon-links",
    "@storybook/addon-essentials",
    '@lullabot/storybook-drupal-addon',
  ],
  "framework": "@storybook/server",
  "core": {
    "builder": "@storybook/builder-webpack5"
  },
  reactOptions: {
    fastRefresh: true,
  },
}

preview.js

export const parameters = {
  server: {
    url: 'http://clserver.lndo.site',
  },
  drupalTheme: 'stark',
  supportedDrupalThemes: {
    olivero: {title: 'Olivero'},
    claro: {title: 'Claro'},
    bartik: {title: 'Bartik'},
    stark: {title: 'Stark'},
  }
};
e0ipso commented 1 year ago

This configuration looks good. I can reproduce locally.

I think there was a regression recently that broke this.