Sha256: 7cd6d62ee05851cf85a994a23864644bec97c07ee474a78367454ef713daa597

Contents?: true

Size: 1.06 KB

Versions: 2

Compression:

Stored size: 1.06 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',
  dark?: Boolean,
}

const Card = ({
  children,
  className,
  dark = false,
  highlight = {},
  padding = 'md',
  selected = false,
  shadow = 'none',
}: CardPropTypes) => {
  const bodyCSS = buildCss('pb_card_body_kit', padding)
  const cardCss = buildCss('pb_card_kit', `shadow_${shadow}`, {
    'dark': dark,
    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

2 entries across 2 versions & 1 rubygems

Version Path
playbook_ui-4.12.0 app/pb_kits/playbook/pb_card/_card.jsx
playbook_ui-4.11.0 app/pb_kits/playbook/pb_card/_card.jsx