Sha256: 7de5791c3ecbf6fddd44bcb5471fcfc8406a28e7013e35c2127d3799343c5330

Contents?: true

Size: 1.01 KB

Versions: 28

Compression:

Stored size: 1.01 KB

Contents

/* @flow */

import React from 'react'
import classnames from 'classnames'

import { buildCss } from '../utilities/props'

type CardPropTypes = {
  children: Array<React.ReactNode> | React.ReactNode,
  className?: String,
  highlight?: {
    position?: 'side' | 'top',
    color?: String
  },
  padding?: 'none' | 'xs' | 'sm' | 'md' | 'lg' | 'xl',
  selected?: Boolean,
  shadow?: 'none' | 'shallow' | 'default' | 'deep' | 'deeper' | 'deepest',
}

const Card = ({
  children,
  className,
  highlight = {},
  padding = 'md',
  selected = false,
  shadow = 'none',
}: CardPropTypes) => {
  const bodyCSS = buildCss('pb_card_body_kit', padding)
  const cardCss = buildCss('pb_card_kit', `shadow_${shadow}`, {
    selected,
    deselected: !selected,
    [`highlight_${highlight.position}`]: highlight.position,
    [`highlight_${highlight.color}`]: highlight.color,
  })

  return (
    <div className={classnames(cardCss, className)}>
      <div className={bodyCSS}>
        {children}
      </div>
    </div>
  )
}

export default Card

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
playbook_ui-4.11.0.pre.alpha3 app/pb_kits/playbook/pb_card/_card.jsx
playbook_ui-4.11.0.pre.alpha.pre.2 app/pb_kits/playbook/pb_card/_card.jsx
playbook_ui-4.10.0 app/pb_kits/playbook/pb_card/_card.jsx
playbook_ui-4.10.0.pre.alpha1 app/pb_kits/playbook/pb_card/_card.jsx
playbook_ui-4.9.0.pre.alpha1 app/pb_kits/playbook/pb_card/_card.jsx
playbook_ui-4.9.0 app/pb_kits/playbook/pb_card/_card.jsx
playbook_ui-4.8.2 app/pb_kits/playbook/pb_card/_card.jsx
playbook_ui-4.8.1 app/pb_kits/playbook/pb_card/_card.jsx
playbook_ui-4.7.1 app/pb_kits/playbook/pb_card/_card.jsx
playbook_ui-4.7.0 app/pb_kits/playbook/pb_card/_card.jsx
playbook_ui-4.6.1 app/pb_kits/playbook/pb_card/_card.jsx
playbook_ui-4.6.0 app/pb_kits/playbook/pb_card/_card.jsx
playbook_ui-4.5.2 app/pb_kits/playbook/pb_card/_card.jsx
playbook_ui-4.5.1 app/pb_kits/playbook/pb_card/_card.jsx
playbook_ui-4.5.0 app/pb_kits/playbook/pb_card/_card.jsx
playbook_ui-4.4.1 app/pb_kits/playbook/pb_card/_card.jsx
playbook_ui-4.4.0 app/pb_kits/playbook/pb_card/_card.jsx
playbook_ui-4.3.1 app/pb_kits/playbook/pb_card/_card.jsx
playbook_ui-4.3.0 app/pb_kits/playbook/pb_card/_card.jsx
playbook_ui-4.2.0 app/pb_kits/playbook/pb_card/_card.jsx