Sha256: afadabdcb1cb6393a8e5695316917309aa99f58dc642ed088d085412c8c8f62c
Contents?: true
Size: 1.82 KB
Versions: 3
Compression:
Stored size: 1.82 KB
Contents
/* @flow */ import React from 'react' import { Body, Title } from '../' import classnames from 'classnames' import { buildAriaProps, buildCss, buildDataProps, } from '../utilities/props' import { globalProps } from '../utilities/globalProps.js' type ProgressPillsProps = { active?: number, aria?: object, className?: string, data?: object, id?: string, 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' : '' }`} key={step} /> ) const ProgressPills = (props: ProgressPillsProps) => { const { active = 0, aria = {}, className, data = {}, id, steps = 3, title, value, dark = false, } = props const darkClass = dark ? '_dark' : '' const ariaProps = buildAriaProps(aria) const dataProps = buildDataProps(data) const classes = classnames(buildCss('pb_progress_pills_kit', darkClass), className, globalProps(props)) return ( <div {...ariaProps} {...dataProps} className={classes} id={id} > <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
3 entries across 3 versions & 1 rubygems