Skip to content
This repository has been archived by the owner on Sep 1, 2022. It is now read-only.

Latest commit

 

History

History
44 lines (32 loc) · 910 Bytes

make-component-story.md

File metadata and controls

44 lines (32 loc) · 910 Bytes

建立 CourseAPI 組件的 Story

這份文件還沒寫完 orz

Story 的位置

原則上置於與 tsx 同目錄:

- button.tsx
- button.stories.tsx

icons 的 stories 是特例,因為 icon 都是 export 在同個檔案, 因此我有另外開一個 stories/ 放各個 icons 的 story:

- icons.tsx
- stories
  - bars.stories.tsx
  - download.stories.tsx
  - [圖示代號].stories.tsx

Story 的範本

詳細寫法可參見 https://ladle.dev/docs/stories

// [component].stories.tsx

import type { Story } from '@ladle/react';
import React from 'react';

import type { ComponentProps } from './[component]';
import { Component } from './[component]';

// eslint-disable-next-line react/function-component-definition
export const Default: Story<ComponentProps> = (props) => (
	<Component {...props} />
);
Default.args = {};
Default.argTypes = {};