Sha256: 7c8b465da7ec0cea4d148d3150d8212eb617c7dcadbb7a91daada6a31c2dafe9

Contents?: true

Size: 1.28 KB

Versions: 38

Compression:

Stored size: 1.28 KB

Contents

/* @flow */

import React from 'react'
import { Body, Title } from '../'

type ProgressPillsProps = {
  active?: Number,
  steps?: Number,
  title?: String,
  value?: String,
  dark?: Boolean,

}

const showSteps = (steps, active, dark) => {
  const items = []

  for (let step = 1; step <= steps; step++) {
    items.push(ProgressPill({ step, active, dark }))
  }

  return items
}

const ProgressPill = ({
  active,
  dark,
  step,
}: ProgressPillProps) => (
  <div
      className={`pb_progress_pill${step <= active ? '_active' : '_inactive'}${dark ? '_dark' : null}`}
      key={step}
  />
)

const ProgressPills = ({ active = 0, steps = 3, title = null, value = null, dark = false }: ProgressPillsProps) => {
  const darkClass = dark ? '_dark' : ''

  return (
    <div className={`pb_progress_pills_kit${darkClass}`}>
      <If condition={title}>
        <div className="progress_pills_status">
          <Title
              dark={dark}
              size={4}
              tag="h4"
              text={title}
          />
          <Body
              color="light"
              dark={dark}
              text={value}
          />
        </div>
      </If>

      <div className="progress_pills">
        {showSteps(steps, active, dark)}
      </div>
    </div>
  )
}

export default ProgressPills

Version data entries

38 entries across 38 versions & 1 rubygems

Version Path
playbook_ui-4.17.0.pre.alpha1 app/pb_kits/playbook/pb_progress_pills/_progress_pills.jsx
playbook_ui-4.16.0 app/pb_kits/playbook/pb_progress_pills/_progress_pills.jsx
playbook_ui-4.15.0 app/pb_kits/playbook/pb_progress_pills/_progress_pills.jsx
playbook_ui-4.14.0 app/pb_kits/playbook/pb_progress_pills/_progress_pills.jsx
playbook_ui-4.15.1.alpha1 app/pb_kits/playbook/pb_progress_pills/_progress_pills.jsx
playbook_ui-4.13.1 app/pb_kits/playbook/pb_progress_pills/_progress_pills.jsx
playbook_ui-4.13.0 app/pb_kits/playbook/pb_progress_pills/_progress_pills.jsx
playbook_ui-4.12.0 app/pb_kits/playbook/pb_progress_pills/_progress_pills.jsx
playbook_ui-4.11.0 app/pb_kits/playbook/pb_progress_pills/_progress_pills.jsx
playbook_ui-4.11.0.pre.alpha3 app/pb_kits/playbook/pb_progress_pills/_progress_pills.jsx
playbook_ui-4.11.0.pre.alpha.pre.2 app/pb_kits/playbook/pb_progress_pills/_progress_pills.jsx
playbook_ui-4.10.0 app/pb_kits/playbook/pb_progress_pills/_progress_pills.jsx
playbook_ui-4.10.0.pre.alpha1 app/pb_kits/playbook/pb_progress_pills/_progress_pills.jsx
playbook_ui-4.9.0.pre.alpha1 app/pb_kits/playbook/pb_progress_pills/_progress_pills.jsx
playbook_ui-4.9.0 app/pb_kits/playbook/pb_progress_pills/_progress_pills.jsx
playbook_ui-4.8.2 app/pb_kits/playbook/pb_progress_pills/_progress_pills.jsx
playbook_ui-4.8.1 app/pb_kits/playbook/pb_progress_pills/_progress_pills.jsx
playbook_ui-4.7.1 app/pb_kits/playbook/pb_progress_pills/_progress_pills.jsx
playbook_ui-4.7.0 app/pb_kits/playbook/pb_progress_pills/_progress_pills.jsx
playbook_ui-4.6.1 app/pb_kits/playbook/pb_progress_pills/_progress_pills.jsx