Skip to content

Commit

Permalink
style(ui): Fix PropTypes
Browse files Browse the repository at this point in the history
  • Loading branch information
vio committed Nov 15, 2019
1 parent 43ff7f4 commit af79834
Show file tree
Hide file tree
Showing 11 changed files with 17 additions and 3,560 deletions.

Large diffs are not rendered by default.

2,793 changes: 0 additions & 2,793 deletions packages/ui/build/storybook/__snapshots__/storyshots.test.js.snap

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ export const BundleAssetsTotalsChartBars = ({ className, jobs }) => {

return (
<div
key={internalBuildNumber}
key={internalBuildNumber || runIndex}
className={css.item}
>
<h3 className={css.itemTitle}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export const DuplicatePackagesWarning = (props) => {
{key}
</p>
<ul className={css.itemPackages}>
{paths.map((path) => <li>{path}</li>)}
{paths.map((path) => <li key={path}>{path}</li>)}
</ul>
</li>
))}
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/src/components/jobs-header/jobs-header.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export const JobsHeader = (props) => {
const { builtAt, hash } = get(job, `meta.${SOURCE_PATH_WEBPACK_STATS}`, {});

return (
<div className={css.job} key={job.internalBuilNumber}>
<div className={css.job} key={job.internalBuilNumber || index}>
<div className={css.jobDescription}>
<h1 className={css.jobTitle}>
<span>
Expand Down
3 changes: 2 additions & 1 deletion packages/ui/src/components/summary-item/summary-item.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ SummaryItem.defaultProps = {
className: '',
data: null,
size: 'medium',
loading: false,
showMetricDescription: false,
showBaselineValue: false,
showDelta: true,
Expand All @@ -107,7 +108,7 @@ SummaryItem.propTypes = {
id: PropTypes.string.isRequired,

/** Loading flag */
loading: PropTypes.bool.isRequired,
loading: PropTypes.bool,

/** Summary data */
data: PropTypes.object, // eslint-disable-line react/forbid-prop-types
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/src/ui/alert/alert.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export const Alert = (props) => {
Alert.propTypes = {
className: PropTypes.string,
kind: PropTypes.string,
children: PropTypes.oneOfType([PropTypes.string, PropTypes.element]).isRequired,
children: PropTypes.node.isRequired,
};

Alert.defaultProps = {
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/src/ui/icon/icon.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,5 @@ Icon.defaultProps = {
Icon.propTypes = {
className: PropTypes.string,
glyph: PropTypes.string.isRequired,
as: PropTypes.oneOfType([PropTypes.string, PropTypes.element, PropTypes.func]),
as: PropTypes.node,
};
2 changes: 1 addition & 1 deletion packages/ui/src/ui/icon/icon.stories.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ stories.add('all', () => (
'pr',
'sort',
].map((glyph) => (
<Icon glyph={glyph} />
<Icon glyph={glyph} key={glyph} />
))
));
2 changes: 1 addition & 1 deletion packages/ui/src/ui/table/table.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export const Table = ({

return (
<tr className={rowClassNames} key={key || index} {...rowProps}>
{header && renderHeader(header)}
{header ? renderHeader(header) : null}
{cells.map((cell, cellIndex) => {
const cellProps = {
key: (cell && cell.key) || cellIndex,
Expand Down
13 changes: 8 additions & 5 deletions packages/ui/src/ui/tooltip/tooltip.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,24 +24,27 @@ export const Tooltip = (props) => {
{...restProps}
>
{children}
<div className={css.tooltip}>
{title}
<span className={css.tooltipArrow} />
</div>
{title && (
<div className={css.tooltip}>
{title}
<span className={css.tooltipArrow} />
</div>
)}
</Component>
);
};

Tooltip.defaultProps = {
className: '',
title: '',
as: 'span',
align: '',
containerRef: null,
};

Tooltip.propTypes = {
className: PropTypes.string,
title: PropTypes.oneOfType([PropTypes.string, PropTypes.node]).isRequired,
title: PropTypes.node,
children: PropTypes.node.isRequired,
as: PropTypes.oneOfType([PropTypes.string, PropTypes.element, PropTypes.func]),
align: PropTypes.oneOf(['', 'topLeft']),
Expand Down

0 comments on commit af79834

Please sign in to comment.