mirror of
https://github.com/storybookjs/storybook.git
synced 2025-04-08 05:51:48 +08:00
In 6.5 the `framework` config option was one of `react`, `angular`, etc. and included Webpack settings. In the 7.0, we’ve updated it so that these are now called `renderers`, and are builder-independent. Now, frameworks contain specific builder information, such as `cra` or `nextjs` (for specific app environments) or `react-webpack5` / `react-vite` (for custom apps). This fixes the `sb init` CLI command to use renderer-specific templates. I also call out some follow-up work to fix automigrations & telemetry
53 lines
1.5 KiB
JavaScript
53 lines
1.5 KiB
JavaScript
import { mount } from '@storybook/riot';
|
|
import { linkTo } from '@storybook/addon-links';
|
|
import { action } from '@storybook/addon-actions';
|
|
|
|
// eslint-disable-next-line
|
|
import MyButtonRaw from 'raw-loader!./MyButton.tag';
|
|
import './MyButton.tag';
|
|
|
|
// More on default export: https://storybook.js.org/docs/riot/writing-stories/introduction#default-export
|
|
export default {
|
|
title: 'Button',
|
|
// More on argTypes: https://storybook.js.org/docs/riot/api/argtypes
|
|
argTypes: {
|
|
content: { control: 'text' },
|
|
},
|
|
};
|
|
|
|
// More on component templates: https://storybook.js.org/docs/riot/writing-stories/introduction#using-args
|
|
const Template = (args) => mount('my-button', args);
|
|
|
|
export const Text = Template.bind({});
|
|
// More on args: https://storybook.js.org/docs/riot/writing-stories/args
|
|
Text.args = {
|
|
content: 'Button',
|
|
onClick: action('onClick'),
|
|
};
|
|
|
|
export const Emoji = Template.bind({});
|
|
Emoji.args = {
|
|
content: '😀 😎 👍 💯',
|
|
};
|
|
|
|
export const WithScenario = () => ({
|
|
tags: [{ content: MyButtonRaw, boundAs: 'MyButton' }],
|
|
template: '<MyButton>With scenario</MyButton>',
|
|
});
|
|
|
|
export const TextWithAction = () =>
|
|
mount('my-button', {
|
|
content: 'Trigger Action',
|
|
onClick: () => action('This was clicked')(),
|
|
});
|
|
|
|
TextWithAction.storyName = 'With an action';
|
|
|
|
export const ButtonWithLinkToAnotherStory = () =>
|
|
mount('my-button', {
|
|
content: 'Go to Welcome Story',
|
|
onClick: linkTo('example-introduction--page'),
|
|
});
|
|
|
|
ButtonWithLinkToAnotherStory.storyName = 'button with link to another story';
|