All files / ts/components/grid row.tsx

100% Statements 12/12
100% Branches 2/2
100% Functions 2/2
100% Lines 11/11
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 30 31 32 33 3420x 20x 20x                         20x 20x 9x 6x 3x         3x           20x   20x  
import * as classNames from 'classnames';
import * as React from 'react';
import { HTMLProps, PureComponent } from 'react';
import { ComponentProps } from '../../types';
 
export type RowProps = ComponentProps & HTMLProps<HTMLElement>;
 
/**
 * Used within a container, section, or column, to keep content on separate rows.
 * Row exists to allow columns to sit within a container / other column and be
 * spaced from each other without adding additional padding to the outsides.
 * It does this by using negative margin left and right. Additionally Row has
 * a clearfix applied which allows floated elements to be placed inside it
 * without it collapsing.
 */
export class Row extends PureComponent<RowProps, {}> {
  public render () {
    const {
      children,
      className,
      component: Component = 'div',
      ...remainingProps
    } = this.props;
 
    return (
      <Component {...remainingProps} className={classNames(['row', className])}>
        {children}
      </Component>
    );
  }
}
 
export default Row;