Sha256: 52d5a0dab30f34a8f255bd3126eba5c1b6d25d648007d28597a180e61b4d8040

Contents?: true

Size: 1.85 KB

Versions: 47

Compression:

Stored size: 1.85 KB

Contents

/* @flow */

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

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 = ({
  aria = {},
  checkmark = false,
  checked = false,
  className,
  dark = false,
  data = {},
  disabled = false,
  icon,
  inputId,
  multi = true,
  name,
  titleText,
  bodyText,
  value,
  onChange,
}: SelectableCardIconProps) => {
  const ariaProps = buildAriaProps(aria)
  const dataProps = buildDataProps(data)

  const css = buildCss({
    'pb_selectable_card_icon_kit': true,
    'checked': checked,
    'dark': dark,
    'disabled': disabled,
    'enabled': !disabled,
  })

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

export default SelectableCardIcon

Version data entries

47 entries across 47 versions & 1 rubygems

Version Path
playbook_ui-6.0.1.pre.alpha6 app/pb_kits/playbook/pb_selectable_card_icon/_selectable_card_icon.jsx
playbook_ui-6.0.1.pre.alpha5 app/pb_kits/playbook/pb_selectable_card_icon/_selectable_card_icon.jsx
playbook_ui-6.0.1.pre.alpha4 app/pb_kits/playbook/pb_selectable_card_icon/_selectable_card_icon.jsx
playbook_ui-6.0.1.pre.alpha3 app/pb_kits/playbook/pb_selectable_card_icon/_selectable_card_icon.jsx
playbook_ui-6.0.1.pre.alpha2 app/pb_kits/playbook/pb_selectable_card_icon/_selectable_card_icon.jsx
playbook_ui-5.2.0.pre.alpha15 app/pb_kits/playbook/pb_selectable_card_icon/_selectable_card_icon.jsx
playbook_ui-5.2.0.pre.alpha14 app/pb_kits/playbook/pb_selectable_card_icon/_selectable_card_icon.jsx
playbook_ui-5.2.0.pre.alpha13 app/pb_kits/playbook/pb_selectable_card_icon/_selectable_card_icon.jsx
playbook_ui-6.0.1 app/pb_kits/playbook/pb_selectable_card_icon/_selectable_card_icon.jsx
playbook_ui-5.2.0.pre.alpha12 app/pb_kits/playbook/pb_selectable_card_icon/_selectable_card_icon.jsx
playbook_ui-6.0.0 app/pb_kits/playbook/pb_selectable_card_icon/_selectable_card_icon.jsx
playbook_ui-5.2.0.pre.alpha11 app/pb_kits/playbook/pb_selectable_card_icon/_selectable_card_icon.jsx
playbook_ui-5.5.1.pre.alpha4 app/pb_kits/playbook/pb_selectable_card_icon/_selectable_card_icon.jsx
playbook_ui-5.5.1.pre.alpha3 app/pb_kits/playbook/pb_selectable_card_icon/_selectable_card_icon.jsx
playbook_ui-5.5.1.pre.alpha2 app/pb_kits/playbook/pb_selectable_card_icon/_selectable_card_icon.jsx
playbook_ui-5.5.1.pre.alpha1 app/pb_kits/playbook/pb_selectable_card_icon/_selectable_card_icon.jsx
playbook_ui-5.2.0.pre.alpha10 app/pb_kits/playbook/pb_selectable_card_icon/_selectable_card_icon.jsx
playbook_ui-5.5.1 app/pb_kits/playbook/pb_selectable_card_icon/_selectable_card_icon.jsx
playbook_ui-5.5.0 app/pb_kits/playbook/pb_selectable_card_icon/_selectable_card_icon.jsx
playbook_ui-5.5.0.pre.alpha1 app/pb_kits/playbook/pb_selectable_card_icon/_selectable_card_icon.jsx