Как добавить описание в сборник рассказов React -> showInfo - PullRequest
0 голосов
/ 18 октября 2019

Мой компонент React является DynamicTable. Я добавил простые PropTypes в свой компонент, но я хочу добавить в каждый атрибут описание тоже.

Вот мои propTypes:

DynamicTable.propTypes = {
    tableCells: PropTypes.shape({
        nameCells: PropTypes.array.isRequired,
        labelCells: PropTypes.array.isRequired
    }).isRequired,
    listRows: PropTypes.array.isRequired
}

Как я могу добавить описания в свой сборник рассказов?

PropTypes, созданные в сборнике рассказов

1 Ответ

0 голосов
/ 18 октября 2019

Похоже, вам нужно использовать встроенные комментарии и реагировать на документы вместе, чтобы заполнить этот столбец.

Input.propTypes = {
  ...DefaultProps.Input,
  /** text, which is shown until the text is written */
  placeholder: PropTypes.string,
  /** size of the input, ordinary by default, could be `md` */
  size: PropTypes.oneOf([undefined, 'md']),
  /** mask for masked input pattern */
  mask: MaskedInput.propTypes.mask,
  /** all the rest params (e.g. onClick) */
  rest: PropTypes.any,
};
babel-plugin-react-docgen (add to .babelrc "plugins": ["react-docgen"])

Ссылки:

https://github.com/storybookjs/storybook/issues/2010 https://github.com/storybookjs/storybook/issues/2708#issuecomment-454156949

...