Check for correct props in Flow or prop-types, change label prop to union, fix typo

This commit is contained in:
Guy Livni 2018-02-02 01:19:46 +02:00
parent 09d03ec903
commit 1ab018a8fd
2 changed files with 6 additions and 6 deletions

View File

@ -4,15 +4,15 @@ import PrettyPropType from './PrettyPropType';
import { TypeInfo } from './proptypes';
const OneOfType = ({ propType }) => {
const { length } = propType.value;
const propTypes = propType.elements || propType.value;
return (
<span>
{propType.value
{propTypes
.map((value, i) => {
const key = `${value.name}${value.value ? `-${value.value}` : ''}`;
return [
<PrettyPropType key={key} propType={value} />,
i < length - 1 ? <span key={`${key}-separator`}> | </span> : null,
i < propTypes.length - 1 ? <span key={`${key}-separator`}> | </span> : null,
];
})
.reduce((acc, tuple) => acc.concat(tuple), [])}

View File

@ -2,11 +2,11 @@
import React from 'react';
type PropsType = {
/** The text to be rendered in the button */
label: string,
/** A multi-type prop to be rendered in the button */
label: string | number,
/** Function to be called when the button is clicked */
onClick?: Function,
/** Boolean representing wether the button is disabled */
/** Boolean representing whether the button is disabled */
disabled?: boolean,
};