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) * @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 = { module.exports = {
"stories": [ "stories": [
"../lib/**/*.stories.js" "../src/**/*.stories.tsx",
], ],
"addons": [ "addons": [
"@storybook/addon-a11y", "@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 }) => { // sb does not yet support new jsx transform by default
// // `configType` has a value of 'DEVELOPMENT' or 'PRODUCTION' // https://github.com/storybookjs/storybook/issues/12881
// // You can change the configuration based on that. // https://github.com/storybookjs/storybook/issues/12952
// // 'PRODUCTION' is used when building the static version of storybook. babel: async (options) => ({
// // Make whatever fine-grained changes you need ...options,
// // Return the altered config presets: [
// return config; ...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/> GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/ */
// import "../src/scss/main.scss" import * as core from "@gnu-taler/taler-wallet-core";
// import { ConfigContextProvider } from '../src/context/config'
// import { TranslationProvider } from '../src/context/translation'
const mockConfig = { const mockConfig = {
backendURL: 'http://demo.taler.net', backendURL: 'http://demo.taler.net',
currency: 'KUDOS' currency: 'KUDOS'
} }
// export const parameters = { export const parameters = {
// controls: { expanded: true }, controls: { expanded: true },
// actions: { argTypesRegex: "^on[A-Z].*" }, actions: { argTypesRegex: "^on[A-Z].*" },
// } }
// export const globalTypes = { export const globalTypes = {
// locale: { locale: {
// name: 'Locale', name: 'Locale',
// description: 'Internationalization locale', description: 'Internationalization locale',
// defaultValue: 'en', defaultValue: 'en',
// toolbar: { toolbar: {
// icon: 'globe', icon: 'globe',
// items: [ items: [
// { value: 'en', right: '🇺🇸', title: 'English' }, { value: 'en', right: '🇺🇸', title: 'English' },
// { value: 'es', right: '🇪🇸', title: 'Spanish' }, { value: 'es', right: '🇪🇸', title: 'Spanish' },
// ], ],
// }, },
// }, },
// }; };
// export const decorators = [
// (Story, { globals }) => {
export const decorators = [
// return <TranslationProvider initial={globals.locale}> (Story, { globals }) => {
// <Story /> core.setupI18n(globals.locale);
// </TranslationProvider> return <Story />
// }, },
// (Story) => <ConfigContextProvider value={mockConfig}> <Story /> </ConfigContextProvider> // (Story) => <ConfigContextProvider value={mockConfig}> <Story /> </ConfigContextProvider>
// ]; ];