Skip to content

Commit

Permalink
fix(ui): Summary - pass first row count as a prop
Browse files Browse the repository at this point in the history
  • Loading branch information
vio committed Dec 4, 2019
1 parent 807e951 commit 4c1d825
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -196069,7 +196069,7 @@ exports[`Storyshots Components/JobHeader with custom content 1`] = `
</div>
`;

exports[`Storyshots Components/JobHeader with showSummaryDelta 1`] = `
exports[`Storyshots Components/JobHeader with showSummaryDelta = false 1`] = `
<div
style={
Object {
Expand Down
8 changes: 5 additions & 3 deletions packages/ui/src/components/summary/summary.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import css from './summary.module.css';
const FIRST_ROW_COUNT = 3;

export const Summary = ({
className, data, keys, loading, showSummaryItemDelta, showSummaryItemBaselineValue,
className, firstRowCount, data, keys, loading, showSummaryItemDelta, showSummaryItemBaselineValue,
}) => {
const getRenderSummaryItem = (itemProps) => (key) => (
<SummaryItem
Expand All @@ -27,10 +27,10 @@ export const Summary = ({
return (
<div className={cx(css.root, className)}>
<div className={css.items}>
{keys.slice(0, FIRST_ROW_COUNT).map(getRenderSummaryItem())}
{keys.slice(0, firstRowCount).map(getRenderSummaryItem())}
</div>
<div className={css.items}>
{keys.slice(FIRST_ROW_COUNT).map(getRenderSummaryItem())}
{keys.slice(firstRowCount).map(getRenderSummaryItem())}
</div>
</div>
);
Expand All @@ -39,6 +39,7 @@ export const Summary = ({
Summary.defaultProps = {
className: '',
data: null,
firstRowCount: FIRST_ROW_COUNT,
keys: [
'webpack.assets.totalInitialSizeJS',
'webpack.assets.totalInitialSizeCSS',
Expand All @@ -62,6 +63,7 @@ Summary.propTypes = {
current: PropTypes.number,
}),
}),
firstRowCount: PropTypes.number,
keys: PropTypes.arrayOf(PropTypes.string),
loading: PropTypes.bool,
showSummaryItemDelta: PropTypes.bool,
Expand Down

0 comments on commit 4c1d825

Please sign in to comment.