Sha256: a06c8f4ae7d6f8bbb2c7d130d480c1f3d05f597c9dbf03afe929ed3680ef073e

Contents?: true

Size: 1.45 KB

Versions: 126

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" | "warning",
  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(
    buildCss('pb_progress_simple_wrapper', align, { dark: dark }),
    globalProps(props),
    className
  )

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

  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

126 entries across 126 versions & 1 rubygems

Version Path
playbook_ui-10.23.0.pre.cachetest app/pb_kits/playbook/pb_progress_simple/_progress_simple.jsx
playbook_ui-10.21.0.pre.alpha.lightbox.2 app/pb_kits/playbook/pb_progress_simple/_progress_simple.jsx
playbook_ui-10.21.0.pre.alpha.lightbox app/pb_kits/playbook/pb_progress_simple/_progress_simple.jsx
playbook_ui-10.21.0.pre.alpha.rg1 app/pb_kits/playbook/pb_progress_simple/_progress_simple.jsx
playbook_ui-10.21.0.pre.alpha.jg1 app/pb_kits/playbook/pb_progress_simple/_progress_simple.jsx
playbook_ui-10.21.0.pre.alpha.na1 app/pb_kits/playbook/pb_progress_simple/_progress_simple.jsx
playbook_ui-10.21.0.pre.alpha.jd1 app/pb_kits/playbook/pb_progress_simple/_progress_simple.jsx
playbook_ui-10.20.0 app/pb_kits/playbook/pb_progress_simple/_progress_simple.jsx
playbook_ui-10.19.0 app/pb_kits/playbook/pb_progress_simple/_progress_simple.jsx
playbook_ui-10.19.0.pre.lightbox app/pb_kits/playbook/pb_progress_simple/_progress_simple.jsx
playbook_ui-10.18.2 app/pb_kits/playbook/pb_progress_simple/_progress_simple.jsx
playbook_ui-10.19.0.pre.popover.alpha1 app/pb_kits/playbook/pb_progress_simple/_progress_simple.jsx
playbook_ui-10.18.1 app/pb_kits/playbook/pb_progress_simple/_progress_simple.jsx
playbook_ui-10.18.0 app/pb_kits/playbook/pb_progress_simple/_progress_simple.jsx
playbook_ui-10.17.0 app/pb_kits/playbook/pb_progress_simple/_progress_simple.jsx
playbook_ui-10.16.0 app/pb_kits/playbook/pb_progress_simple/_progress_simple.jsx
playbook_ui-10.15.1 app/pb_kits/playbook/pb_progress_simple/_progress_simple.jsx
playbook_ui-10.15.1.pre.alpha.rubocop.deps app/pb_kits/playbook/pb_progress_simple/_progress_simple.jsx
playbook_ui-10.15.0 app/pb_kits/playbook/pb_progress_simple/_progress_simple.jsx
playbook_ui-10.14.1.pre.alpha2 app/pb_kits/playbook/pb_progress_simple/_progress_simple.jsx