Sha256: 0ee67f2aa6b348de02ebe23993abd561fb18577fea39a5f8c37f4e145a1dcaa5

Contents?: true

Size: 1.44 KB

Versions: 82

Compression:

Stored size: 1.44 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(
    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

82 entries across 82 versions & 1 rubygems

Version Path
playbook_ui-7.3.0.pre.alpha4 app/pb_kits/playbook/pb_progress_simple/_progress_simple.jsx
playbook_ui-7.3.0.pre.alpha3 app/pb_kits/playbook/pb_progress_simple/_progress_simple.jsx
playbook_ui-7.3.0.pre.alpha1 app/pb_kits/playbook/pb_progress_simple/_progress_simple.jsx
playbook_ui-7.2.0 app/pb_kits/playbook/pb_progress_simple/_progress_simple.jsx
playbook_ui-7.1.2 app/pb_kits/playbook/pb_progress_simple/_progress_simple.jsx
playbook_ui-7.1.0.pre.alpha2 app/pb_kits/playbook/pb_progress_simple/_progress_simple.jsx
playbook_ui-7.1.1.pre.alpha1 app/pb_kits/playbook/pb_progress_simple/_progress_simple.jsx
playbook_ui-7.0.1 app/pb_kits/playbook/pb_progress_simple/_progress_simple.jsx
playbook_ui-7.1.1 app/pb_kits/playbook/pb_progress_simple/_progress_simple.jsx
playbook_ui-7.1.0.pre.alpha1 app/pb_kits/playbook/pb_progress_simple/_progress_simple.jsx
playbook_ui-7.1.0 app/pb_kits/playbook/pb_progress_simple/_progress_simple.jsx
playbook_ui-7.0.1.pre.alpha15 app/pb_kits/playbook/pb_progress_simple/_progress_simple.jsx
playbook_ui-6.8.2.pre.alpha1 app/pb_kits/playbook/pb_progress_simple/_progress_simple.jsx
playbook_ui-7.0.0.pre.alpha15 app/pb_kits/playbook/pb_progress_simple/_progress_simple.jsx
playbook_ui-7.0.1.pre.alpha14 app/pb_kits/playbook/pb_progress_simple/_progress_simple.jsx
playbook_ui-7.0.0.pre.alpha14 app/pb_kits/playbook/pb_progress_simple/_progress_simple.jsx
playbook_ui-7.0.0.pre.alpha13 app/pb_kits/playbook/pb_progress_simple/_progress_simple.jsx
playbook_ui-7.0.0.pre.alpha12 app/pb_kits/playbook/pb_progress_simple/_progress_simple.jsx
playbook_ui-7.0.0 app/pb_kits/playbook/pb_progress_simple/_progress_simple.jsx
playbook_ui-7.0.0.pre.alpha11 app/pb_kits/playbook/pb_progress_simple/_progress_simple.jsx