natterstefan / nextjs-template

A practical starter template for Nextjs, which has Tailwind, Cypress, Docker, Storybook, Jest, ESLint, Prettier, and more built-in. ๐Ÿš€
https://nextjs-template-app.vercel.app
MIT License
32 stars 4 forks source link

Storybook - Essential Addons Setup #22

Open natterstefan opened 3 years ago

natterstefan commented 3 years ago

Feature Request

Add more essential addons to the current setup (e.g. nextjs router, data handling as soon as we add #12 for instance).

Basic example

Motivation

Make it easier for starters to use Storybook and make the most out of it.

natterstefan commented 2 years ago

And improve typings of stories:

// src: https://storybook.js.org/docs/react/get-started/whats-a-story/
// Button.stories.ts|tsx

import React from 'react';

import { ComponentStory, ComponentMeta } from '@storybook/react';

import { Button, ButtonProps } from './Button';

export default {
  /* ๐Ÿ‘‡ The title prop is optional.
  * See https://storybook.js.org/docs/react/configure/overview#configure-story-loading
  * to learn how to generate automatic titles
  */
  title: 'Button',
  component: Button,
} as ComponentMeta<typeof Button>;

//๐Ÿ‘‡ We create a โ€œtemplateโ€ of how args map to rendering
const Template: ComponentStory<typeof Button> = (args) => <Button {...args} />;

export const Primary = Template.bind({});

Primary.args = {
  primary: true,
  label: 'Button',
};