Sha256: 18206d5a1c90d652899a95b5dc40fcbe539c6216e399d79a29e7c1711936be89

Contents?: true

Size: 1.75 KB

Versions: 644

Compression:

Stored size: 1.75 KB

Contents

import React from 'react'
import classnames from 'classnames'

import { buildCss, buildDataProps, buildHtmlProps } from '../utilities/props'
import { deprecatedProps, globalProps } from '../utilities/globalProps'
import DateTime from '../pb_kit/dateTime';

import Body from '../pb_body/_body'
import Caption from '../pb_caption/_caption'

type TimeStackedProps = {
  align?: 'left' | 'center' | 'right',
  className?: string | string[],
  dark?: boolean,
  data?: { [key: string]: string },
  date?: Date,
  htmlOptions?: {[key: string]: string | number | boolean | (() => void)},
  id?: string,
  time?: number | Date,
  timeZone?: string,
}

const TimeStackedDefault = (props: TimeStackedProps): React.ReactElement => {
  if (props.date) deprecatedProps() //date prop is deprecated, use time instead

  const {
    align = 'left',
    className,
    dark,
    data = {},
    date,
    htmlOptions = {},
    time,
    timeZone,
  } = props

  const classes = classnames(
    buildCss('pb_time_stacked_kit', align),
    globalProps(props),
    className
  )
   const dataProps = buildDataProps(data)
   const htmlProps = buildHtmlProps(htmlOptions)

  return (
    <div
        className={classes}
        {...dataProps}
        {...htmlProps}
    >
      <Body
          className={classnames('pb_time_stacked', 'time-spacing')}
          color="light"
          dark={dark}
      >
        <time>
          {DateTime.toTimeWithMeridiem(date ? date : new Date(time), timeZone)}
          <Caption
              className="pb_time_stacked"
              color="light"
              dark={dark}
              tag="span"
              text={DateTime.toTimeZone(date ? date : new Date(time), timeZone)}
          />
        </time>
      </Body>
    </div>
  )
}

export default TimeStackedDefault

Version data entries

644 entries across 644 versions & 1 rubygems

Version Path
playbook_ui-14.10.0.pre.rc.2 app/pb_kits/playbook/pb_time_stacked/_time_stacked.tsx
playbook_ui-14.9.0.pre.alpha.play1742globalheightfixes4766 app/pb_kits/playbook/pb_time_stacked/_time_stacked.tsx
playbook_ui-14.10.0.pre.rc.1 app/pb_kits/playbook/pb_time_stacked/_time_stacked.tsx
playbook_ui-14.9.0.pre.alpha.PBNTR686advancedtablepaginationpoc4747 app/pb_kits/playbook/pb_time_stacked/_time_stacked.tsx
playbook_ui-14.9.0.pre.alpha.pbntr700newresettodefaultprop4736 app/pb_kits/playbook/pb_time_stacked/_time_stacked.tsx
playbook_ui-14.10.0.pre.rc.0 app/pb_kits/playbook/pb_time_stacked/_time_stacked.tsx
playbook_ui-14.9.0 app/pb_kits/playbook/pb_time_stacked/_time_stacked.tsx
playbook_ui-14.9.0.pre.rc.18 app/pb_kits/playbook/pb_time_stacked/_time_stacked.tsx
playbook_ui-14.9.0.pre.rc.17 app/pb_kits/playbook/pb_time_stacked/_time_stacked.tsx
playbook_ui-14.9.0.pre.rc.16 app/pb_kits/playbook/pb_time_stacked/_time_stacked.tsx
playbook_ui-14.9.0.pre.rc.15 app/pb_kits/playbook/pb_time_stacked/_time_stacked.tsx
playbook_ui-14.9.0.pre.rc.14 app/pb_kits/playbook/pb_time_stacked/_time_stacked.tsx
playbook_ui-14.9.0.pre.rc.13 app/pb_kits/playbook/pb_time_stacked/_time_stacked.tsx
playbook_ui-14.9.0.pre.rc.12 app/pb_kits/playbook/pb_time_stacked/_time_stacked.tsx
playbook_ui-14.9.0.pre.rc.11 app/pb_kits/playbook/pb_time_stacked/_time_stacked.tsx
playbook_ui-14.9.0.pre.rc.10 app/pb_kits/playbook/pb_time_stacked/_time_stacked.tsx
playbook_ui-14.8.0.pre.alpha.PBNTR713dropdowncustomtriggerbug4696 app/pb_kits/playbook/pb_time_stacked/_time_stacked.tsx
playbook_ui-14.9.0.pre.rc.9 app/pb_kits/playbook/pb_time_stacked/_time_stacked.tsx
playbook_ui-14.8.0.pre.alpha.PLAY1680newwidthprop4661 app/pb_kits/playbook/pb_time_stacked/_time_stacked.tsx
playbook_ui-14.8.0.pre.alpha.PLAY1658tanstackbump4657 app/pb_kits/playbook/pb_time_stacked/_time_stacked.tsx