knowii-oss / knowii

Knowii is a next-gen Community Knowledge Management platform
https://knowii.net
GNU Affero General Public License v3.0
9 stars 1 forks source link

Add Storybook #657

Open dsebastien opened 2 months ago

dsebastien commented 2 months ago

Related: https://github.com/area17/blast

dsebastien commented 2 months ago

Old main.js

module.exports = {
  stories: ['../src/lib/**/*.stories.mdx', '../src/lib/**/*.stories.@(js|jsx|ts|tsx)'],
  addons: ['@storybook/addon-essentials', '@nx/react/plugins/storybook', 'storybook-tailwind-dark-mode', '@storybook/addon-mdx-gfm'],
  // Customize the Webpack configuration
  // References
  // - https://storybook.js.org/docs/react/builders/webpack#extending-storybooks-webpack-config
  // - https://nx.dev/packages/storybook/documents/custom-builder-configs
  webpackFinal: async (config, { configType }) => {
    config.resolve.alias = {
      ...config.resolve.alias,
    };
    return config;
  },
  framework: {
    name: '@storybook/react-webpack5',
    options: {},
  },
  docs: {
    autodocs: true,
  },
};
dsebastien commented 2 months ago

Old preview.ts

import { Preview } from '@storybook/react';

import './tailwind-imports.css';

const preview: Preview = {
  parameters: {},
};

export default preview;
dsebastien commented 2 months ago

Old tailwind-imports.css

/*
 * Wrap Tailwind's base and utilities in separate layers
 * Reference: https://primereact.org/tailwind/#csslayer
 */
@layer tailwind-base, primereact, tailwind-utilities;

@import 'primereact/resources/themes/lara-light-pink/theme.css' layer(primereact);

@layer tailwind-base {
  @tailwind base;
}

@layer tailwind-utilities {
  @tailwind components;
  @tailwind utilities;
}

/* TODO import app styles.css */