Sha256: e630d0e3199079ce063480596541dc74a234f8141ab5dc729a5dc610aea8d53b

Contents?: true

Size: 1.94 KB

Versions: 6

Compression:

Stored size: 1.94 KB

Contents

/* @flow */

import React from 'react'
import classnames from 'classnames'
import { Body, SelectableCard, SelectableIcon } from '../'
import { globalProps } from '../utilities/globalProps.js'

import {
  buildAriaProps,
  buildCss,
  buildDataProps,
} from '../utilities/props'

type SelectableCardIconProps = {
  aria?: Object,
  checked?: Boolean,
  checkmark: Boolean,
  className?: String,
  dark?: Boolean,
  data?: Object,
  disabled?: Boolean,
  icon?: String,
  inputId?: String,
  multi?: Boolean,
  name?: String,
  titleText?: String,
  bodyText?: String,
  value?: String,
  onChange?: (e) => void,
}

const SelectableCardIcon = (props: SelectableCardIconProps) => {
  const {
    aria = {},
    checkmark = false,
    checked = false,
    className,
    dark = false,
    data = {},
    disabled = false,
    icon,
    inputId,
    multi = true,
    name,
    titleText,
    bodyText,
    value,
    onChange,
  } = props

  const ariaProps = buildAriaProps(aria)
  const dataProps = buildDataProps(data)

  const classes = classnames(buildCss('pb_selectable_card_icon_kit',
    { 'checked': checked,
      'disabled': disabled,
      'enabled': !disabled },
    className), globalProps(props))

  return (
    <div
        {...ariaProps}
        {...dataProps}
        className={classes}
    >
      <SelectableCard
          checked={checked}
          dark={dark}
          disabled={disabled}
          icon={checkmark}
          inputId={inputId}
          multi={multi}
          name={name}
          onChange={onChange}
          value={value}
      >
        {
          <>
            <SelectableIcon
                icon={icon}
                inputs="disabled"
                size="2x"
                text={titleText}
            />
            <Body
                color="light"
                dark={dark}
                text={bodyText}
            />
          </>
        }
      </SelectableCard>
    </div>
  )
}

export default SelectableCardIcon

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
playbook_ui-6.1.0.pre.alpha5 app/pb_kits/playbook/pb_selectable_card_icon/_selectable_card_icon.jsx
playbook_ui-6.1.0.pre.alpha4 app/pb_kits/playbook/pb_selectable_card_icon/_selectable_card_icon.jsx
playbook_ui-6.1.0.pre.alpha3 app/pb_kits/playbook/pb_selectable_card_icon/_selectable_card_icon.jsx
playbook_ui-6.1.0.pre.alpha2 app/pb_kits/playbook/pb_selectable_card_icon/_selectable_card_icon.jsx
playbook_ui-6.1.0.pre.alpha1 app/pb_kits/playbook/pb_selectable_card_icon/_selectable_card_icon.jsx
playbook_ui-6.1.0 app/pb_kits/playbook/pb_selectable_card_icon/_selectable_card_icon.jsx