fix sb config

This commit is contained in:
Sebastian 2021-06-02 10:41:00 -03:00
parent 5e6cc41b7a
commit 9f09f5a1a5
No known key found for this signature in database
GPG Key ID: BE4FF68352439FC1
3 changed files with 57 additions and 39 deletions

View File

@ -19,4 +19,8 @@
* @author Sebastian Javier Marchano (sebasjm)
*/
{
//FIXME: check if we can remove this preset and just use default storybook presets
"presets": [
"preact-cli/babel"
]
}

View File

@ -22,18 +22,34 @@
module.exports = {
"stories": [
"../lib/**/*.stories.js"
"../src/**/*.stories.tsx",
],
"addons": [
"@storybook/addon-a11y",
"@storybook/addon-essentials" //docs, control, actions, viewpot, toolbar, background
"@storybook/addon-essentials" //docs, control, actions, viewport, toolbar, background
],
// webpackFinal: async (config, { configType }) => {
// // `configType` has a value of 'DEVELOPMENT' or 'PRODUCTION'
// // You can change the configuration based on that.
// // 'PRODUCTION' is used when building the static version of storybook.
// // Make whatever fine-grained changes you need
// // Return the altered config
// return config;
// },
// sb does not yet support new jsx transform by default
// https://github.com/storybookjs/storybook/issues/12881
// https://github.com/storybookjs/storybook/issues/12952
babel: async (options) => ({
...options,
presets: [
...options.presets,
[
'@babel/preset-react', {
runtime: 'automatic',
},
'preset-react-jsx-transform'
],
],
}),
webpackFinal: (config) => {
// should be removed after storybook 6.3
// https://github.com/storybookjs/storybook/issues/12853#issuecomment-821576113
config.resolve.alias = {
react: "preact/compat",
"react-dom": "preact/compat",
};
return config;
},
}

View File

@ -14,41 +14,39 @@
GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/
// import "../src/scss/main.scss"
// import { ConfigContextProvider } from '../src/context/config'
// import { TranslationProvider } from '../src/context/translation'
import * as core from "@gnu-taler/taler-wallet-core";
const mockConfig = {
backendURL: 'http://demo.taler.net',
currency: 'KUDOS'
}
// export const parameters = {
// controls: { expanded: true },
// actions: { argTypesRegex: "^on[A-Z].*" },
// }
export const parameters = {
controls: { expanded: true },
actions: { argTypesRegex: "^on[A-Z].*" },
}
// export const globalTypes = {
// locale: {
// name: 'Locale',
// description: 'Internationalization locale',
// defaultValue: 'en',
// toolbar: {
// icon: 'globe',
// items: [
// { value: 'en', right: '🇺🇸', title: 'English' },
// { value: 'es', right: '🇪🇸', title: 'Spanish' },
// ],
// },
// },
// };
export const globalTypes = {
locale: {
name: 'Locale',
description: 'Internationalization locale',
defaultValue: 'en',
toolbar: {
icon: 'globe',
items: [
{ value: 'en', right: '🇺🇸', title: 'English' },
{ value: 'es', right: '🇪🇸', title: 'Spanish' },
],
},
},
};
// export const decorators = [
// (Story, { globals }) => {
// return <TranslationProvider initial={globals.locale}>
// <Story />
// </TranslationProvider>
// },
export const decorators = [
(Story, { globals }) => {
core.setupI18n(globals.locale);
return <Story />
},
// (Story) => <ConfigContextProvider value={mockConfig}> <Story /> </ConfigContextProvider>
// ];
];