Sha256: d16b1291fddcf93a72bc04768addcb24fafcdfabe62e3efb4df9200103c40677

Contents?: true

Size: 1.45 KB

Versions: 37

Compression:

Stored size: 1.45 KB

Contents

/* @flow */
import React from 'react'
import classnames from 'classnames'
import { buildCss } from '../utilities/props'
import { globalProps } from '../utilities/globalProps.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 }),
    globalProps(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

37 entries across 37 versions & 1 rubygems

Version Path
playbook_ui-7.3.0.pre.alpha2 app/pb_kits/playbook/pb_progress_simple/_progress_simple.jsx
playbook_ui-6.7.0.pre.alpha1 app/pb_kits/playbook/pb_progress_simple/_progress_simple.jsx
playbook_ui-6.7.0 app/pb_kits/playbook/pb_progress_simple/_progress_simple.jsx
playbook_ui-6.6.1 app/pb_kits/playbook/pb_progress_simple/_progress_simple.jsx
playbook_ui-7.0.0.pre.alpha10 app/pb_kits/playbook/pb_progress_simple/_progress_simple.jsx
playbook_ui-6.6.0 app/pb_kits/playbook/pb_progress_simple/_progress_simple.jsx
playbook_ui-6.5.2 app/pb_kits/playbook/pb_progress_simple/_progress_simple.jsx
playbook_ui-7.0.1.pre.alpha12 app/pb_kits/playbook/pb_progress_simple/_progress_simple.jsx
playbook_ui-7.0.1.pre.alpha11 app/pb_kits/playbook/pb_progress_simple/_progress_simple.jsx
playbook_ui-7.0.1.pre.alpha10 app/pb_kits/playbook/pb_progress_simple/_progress_simple.jsx
playbook_ui-7.0.1.pre.alpha9 app/pb_kits/playbook/pb_progress_simple/_progress_simple.jsx
playbook_ui-6.5.1 app/pb_kits/playbook/pb_progress_simple/_progress_simple.jsx
playbook_ui-6.5.0 app/pb_kits/playbook/pb_progress_simple/_progress_simple.jsx
playbook_ui-7.0.1.pre.alpha8 app/pb_kits/playbook/pb_progress_simple/_progress_simple.jsx
playbook_ui-7.0.1.pre.alpha7 app/pb_kits/playbook/pb_progress_simple/_progress_simple.jsx
playbook_ui-7.0.1.pre.alpha6 app/pb_kits/playbook/pb_progress_simple/_progress_simple.jsx
playbook_ui-7.0.1.pre.alpha5 app/pb_kits/playbook/pb_progress_simple/_progress_simple.jsx
playbook_ui-7.0.1.pre.alpha4 app/pb_kits/playbook/pb_progress_simple/_progress_simple.jsx
playbook_ui-7.0.1.pre.alpha3 app/pb_kits/playbook/pb_progress_simple/_progress_simple.jsx
playbook_ui-7.0.1.pre.alpha2 app/pb_kits/playbook/pb_progress_simple/_progress_simple.jsx