Sha256: 23cf22182699296cafd82e1b6ab3da2d3edf22a1447d6545e71eafd57336376e

Contents?: true

Size: 1.43 KB

Versions: 6

Compression:

Stored size: 1.43 KB

Contents

/* @flow */
import React from 'react'
import classnames from 'classnames'
import { buildCss } from '../utilities/props'
import { spacing } from '../utilities/spacing.js'

type ProgressSimpleProps = {
  align?: "left" | "center" | "right",
  className?: String | Array<String>,
  dark?: Boolean,
  data?: String,
  id?: String,
  max?: String,
  muted: Boolean,
  percent: String,
  value: Number,
  variant?: "default" | "positive" | "negative",
  width: String,
}

const ProgressSimple = (props: ProgressSimpleProps) => {
  const {
    align,
    className,
    dark = false,
    max,
    muted = false,
    percent = '',
    value,
    variant = 'default',
    width = '100%',
  } = props
  const styles = {
    width: width,
  }

  const variantStyle = variant == 'default' ? '' : variant

  const valueStyles = {
    width: percent ? `${percent}%` : `${(value * 100) / max}%`,
  }

  const wrapperClass = classnames(
    className,
    buildCss('pb_progress_simple_wrapper', align, { dark: dark }),
    spacing(props)
  )

  const kitClass = classnames(
    className,
    buildCss('pb_progress_simple_kit', { muted: muted }, variantStyle, align)
  )

  return (
    <div className={wrapperClass}>
      <div
          className={kitClass}
          data-value={value}
          style={styles}
      >
        <div
            className="progress_simple_value"
            style={valueStyles}
        />
      </div>
    </div>
  )
}

export default ProgressSimple

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
playbook_ui-6.0.1.pre.alpha5 app/pb_kits/playbook/pb_progress_simple/_progress_simple.jsx
playbook_ui-6.0.1.pre.alpha4 app/pb_kits/playbook/pb_progress_simple/_progress_simple.jsx
playbook_ui-6.0.1.pre.alpha3 app/pb_kits/playbook/pb_progress_simple/_progress_simple.jsx
playbook_ui-6.0.1.pre.alpha2 app/pb_kits/playbook/pb_progress_simple/_progress_simple.jsx
playbook_ui-6.0.1 app/pb_kits/playbook/pb_progress_simple/_progress_simple.jsx
playbook_ui-6.0.0 app/pb_kits/playbook/pb_progress_simple/_progress_simple.jsx