Sha256: 1800ef7cc88bd7240227fa3e17bb11fed1d9679e9b8634bec7dfe77d11b0cce2

Contents?: true

Size: 1.71 KB

Versions: 11

Compression:

Stored size: 1.71 KB

Contents

import React from 'react'
import classnames from 'classnames'
import { buildCss, buildDataProps, buildHtmlProps } from '../utilities/props'
import { globalProps } from '../utilities/globalProps'

type ProgressSimpleProps = {
  align?: "left" | "center" | "right",
  className?: string | string[],
  dark?: boolean,
  data?: string,
  htmlOptions?: {[key: string]: string | number | boolean | (() => void)},
  id?: string,
  max?: number,
  muted: boolean,
  percent: string,
  value: number,
  variant?: "default" | "positive" | "negative" | "warning",
  width: string,
}

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

  const dataProps = buildDataProps(data)
  const htmlProps = buildHtmlProps(htmlOptions)
  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 
      {...dataProps}
      {...htmlProps}
      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

11 entries across 11 versions & 1 rubygems

Version Path
playbook_ui-13.15.0.pre.alpha.play10841940 app/pb_kits/playbook/pb_progress_simple/_progress_simple.tsx
playbook_ui-13.15.0.pre.alpha.1132globalpropdatepickerspacing1929 app/pb_kits/playbook/pb_progress_simple/_progress_simple.tsx
playbook_ui-13.15.0.pre.alpha.PLAY11311893 app/pb_kits/playbook/pb_progress_simple/_progress_simple.tsx
playbook_ui-13.15.0.pre.alpha.reactselectbump581876 app/pb_kits/playbook/pb_progress_simple/_progress_simple.tsx
playbook_ui-13.15.0.pre.alpha.PLAY10831873 app/pb_kits/playbook/pb_progress_simple/_progress_simple.tsx
playbook_ui-13.14.0.pre.alpha.play1101betaicons1825 app/pb_kits/playbook/pb_progress_simple/_progress_simple.tsx
playbook_ui-13.14.0.pre.alpha.play1101betaicons1798 app/pb_kits/playbook/pb_progress_simple/_progress_simple.tsx
playbook_ui-13.14.0.pre.alpha.play1120lintdatepicker1797 app/pb_kits/playbook/pb_progress_simple/_progress_simple.tsx
playbook_ui-13.15.0 app/pb_kits/playbook/pb_progress_simple/_progress_simple.tsx
playbook_ui-13.13.0.pre.alpha.play10821727 app/pb_kits/playbook/pb_progress_simple/_progress_simple.tsx
playbook_ui-13.13.0.pre.alpha.play10821726 app/pb_kits/playbook/pb_progress_simple/_progress_simple.tsx