Sha256: 33bd860e16dbb421921effc6ca8c5c58ccdcaa79d580345ac3a142d9f2d9e656

Contents?: true

Size: 1.11 KB

Versions: 3

Compression:

Stored size: 1.11 KB

Contents

/* @flow */

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

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

const cardCSS = ({
  highlight={},
  selected=false,
  shadow='none'
}: CardPropTypes) => {
  let css = 'pb_card_kit'
  css += highlight.position ? `_highlight_${highlight.position}` : null
  css += highlight.color ? `_highlight_${highlight.color}` : null
  css += selected ? '_selected' : '_deselected'
  css += `_shadow_${shadow}`
  return css
}

const bodyCSS = ({padding='md'}: CardPropTypes) => {
  let css = 'pb_card_body_kit'
  css += `_${padding}`
  return css
}

const Card = (props: CardPropTypes) => {
  const {
    children,
    className
  } = props

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

export default Card

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
playbook_ui-3.0.1 app/pb_kits/playbook/pb_card/_card.jsx
playbook_ui-3.0.0 app/pb_kits/playbook/pb_card/_card.jsx
playbook_ui-2.9.9 app/pb_kits/playbook/pb_card/_card.jsx