All files / packages/design-system/shared/components DisplayGrid.jsx

0% Statements 0/4
0% Branches 0/2
0% Functions 0/2
0% Lines 0/4

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29                                                         
// Copyright (c) 2015-present, salesforce.com, inc. All rights reserved
// Licensed under BSD 3-Clause - see LICENSE.txt or git.io/sfdc-license
 
import React from 'react';
import DisplayColumn from './DisplayColumn';
 
class DisplayGrid extends React.Component {
  render() {
    return (
      <div className="slds-grid slds-grid_pull-padded slds-wrap slds-gutters">
        {this.props.children}
      </div>
    );
  }
}
 
DisplayGrid.propTypes = {
  children: (props, propName, componentName) =>
    React.Children
      .toArray(props.children)
      .every(child => child.type === DisplayColumn)
      ? null
      : new Error(
          `${componentName} children should be of type ${DisplayColumn.name}.`
        )
};
 
export default DisplayGrid;