All files / px-table-view px-table-row.js

0% Statements 0/3
0% Branches 0/20
0% Functions 0/1
0% Lines 0/3
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 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71                                                                                                                                             
import React from 'react';
import style from './px-table-row-style.scss';
import classnames from 'classnames';
 
 
/**
 * px-table-row component
 * https://github.com/PredixDev/px-table-view/blob/master/px-table-row.html
 */
export default ({
  title = 'Row Title',
  subtitle,
  body,
  image,
 
  labelLeft,
  labelRight,
 
  iconLeft,
  iconRight,
 
  editMode,
 
  tappable,
  underlayContent,
  rowContent,
  children
}) => {
 
  const baseClassnames = classnames(
    'table-row',
    {'table-row--tappable': tappable}
  );
 
 
  const mediaClassnames = classnames(
    'table-row__media',
    { 'table-row__media--icon': iconLeft || iconRight },
    { 'table-row__media--left': iconLeft },
    { 'table-row__media--right': iconRight }
  );
 
  return (
    <div className='px-table-row'>
      <div className={baseClassnames}>
        {labelLeft && <span className="table-row__label table-row__label--left">{labelLeft}</span>}
        {image && <div className="table-row__media table-row__media--image"><img src={image} alt={title}/></div>}
        {(iconLeft || iconLeft) && <div className={mediaClassnames}>{iconLeft}</div>}
 
 
        {editMode && <div className="table-row__media table-row__media--icon table-row__media--right"><button className="btn btn--bare table-row__handle">hamburger</button></div>}
        {labelRight && <span className="table-row__label table-row__label--right">{labelRight}</span>}
 
        <div className="table-row__content">
          {title && <span className="table-row__title">{title}</span>}
          {subtitle && <span className="table-row__subtitle">{subtitle}</span>}
          {body && <span className="table-row__body">{body}</span>}
          {rowContent}
        </div>
      </div>
      <div className="table-row__content">
        {children}
      </div>
      <div id="underlay" className="flex flex--stretch">
        {underlayContent}
      </div>
      <style jsx global>{style}</style>
    </div>
  );
}