Sha256: 06f235d0fbdfdd450289908b9fd080b4f5e1dd3516fa64ad05ca8db38c292273

Contents?: true

Size: 1.74 KB

Versions: 504

Compression:

Stored size: 1.74 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): React.ReactElement => {
  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

504 entries across 504 versions & 1 rubygems

Version Path
playbook_ui-13.20.0.pre.alpha.PLAY12572402 app/pb_kits/playbook/pb_progress_simple/_progress_simple.tsx
playbook_ui-13.21.0 app/pb_kits/playbook/pb_progress_simple/_progress_simple.tsx
playbook_ui-13.20.0.pre.alpha.PBNTR225advancedtablefeedback2375 app/pb_kits/playbook/pb_progress_simple/_progress_simple.tsx
playbook_ui-13.19.0.pre.alpha.PBNTR200addadvancedtablekitdarkmodestyles2346 app/pb_kits/playbook/pb_progress_simple/_progress_simple.tsx
playbook_ui-13.19.0.pre.alpha.play1174fixconfimationtoastmobilebug2345 app/pb_kits/playbook/pb_progress_simple/_progress_simple.tsx
playbook_ui-13.19.0.pre.alpha.play1174fixconfimationtoastmobilebug2342 app/pb_kits/playbook/pb_progress_simple/_progress_simple.tsx
playbook_ui-13.19.0.pre.alpha.play1186collapsiblenaviconcolorbug2321 app/pb_kits/playbook/pb_progress_simple/_progress_simple.tsx
playbook_ui-13.19.0.pre.alpha.PBNTR211tablekitsubcomponentsreact2318 app/pb_kits/playbook/pb_progress_simple/_progress_simple.tsx
playbook_ui-13.19.0.pre.alpha.play1174fixconfimationtoastmobilebug2306 app/pb_kits/playbook/pb_progress_simple/_progress_simple.tsx
playbook_ui-13.19.0.pre.alpha.play1174fixconfimationtoastmobilebug2305 app/pb_kits/playbook/pb_progress_simple/_progress_simple.tsx
playbook_ui-13.20.0 app/pb_kits/playbook/pb_progress_simple/_progress_simple.tsx
playbook_ui-13.19.0.pre.alpha.play1141iconkitusinglibrary2264 app/pb_kits/playbook/pb_progress_simple/_progress_simple.tsx
playbook_ui-13.19.0.pre.alpha.PBNTR207tabledivsupport2261 app/pb_kits/playbook/pb_progress_simple/_progress_simple.tsx
playbook_ui-13.19.0.pre.alpha.PBNTR207tabledivsupport2245 app/pb_kits/playbook/pb_progress_simple/_progress_simple.tsx
playbook_ui-13.19.0 app/pb_kits/playbook/pb_progress_simple/_progress_simple.tsx
playbook_ui-13.18.0.pre.alpha.thor93bargraphoptions2219 app/pb_kits/playbook/pb_progress_simple/_progress_simple.tsx
playbook_ui-13.18.0.pre.alpha.thor93bargraphoptions2211 app/pb_kits/playbook/pb_progress_simple/_progress_simple.tsx
playbook_ui-13.18.0.pre.alpha.play1141iconkitusinglibrary2210 app/pb_kits/playbook/pb_progress_simple/_progress_simple.tsx
playbook_ui-13.18.0.pre.alpha.PLAY12062203 app/pb_kits/playbook/pb_progress_simple/_progress_simple.tsx
playbook_ui-13.18.0.pre.alpha.powercentrainplaybookpt22201 app/pb_kits/playbook/pb_progress_simple/_progress_simple.tsx