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.11.1.pre.alpha.PLAY17445539 app/pb_kits/playbook/pb_time_stacked/_time_stacked.tsx
playbook_ui-14.11.1.pre.alpha.PBNTR798datepickerturbo5537 app/pb_kits/playbook/pb_time_stacked/_time_stacked.tsx
playbook_ui-14.11.1.pre.alpha.pbntr703collapsiblerowsrails5536 app/pb_kits/playbook/pb_time_stacked/_time_stacked.tsx
playbook_ui-14.11.1.pre.alpha.PLAY1751pbcontenttagpt25529 app/pb_kits/playbook/pb_time_stacked/_time_stacked.tsx
playbook_ui-14.11.1.pre.alpha.PBNTR7495495 app/pb_kits/playbook/pb_time_stacked/_time_stacked.tsx
playbook_ui-14.12.0.pre.rc.11 app/pb_kits/playbook/pb_time_stacked/_time_stacked.tsx
playbook_ui-14.12.0.pre.rc.10 app/pb_kits/playbook/pb_time_stacked/_time_stacked.tsx
playbook_ui-14.12.0.pre.rc.9 app/pb_kits/playbook/pb_time_stacked/_time_stacked.tsx
playbook_ui-14.12.0.pre.rc.8 app/pb_kits/playbook/pb_time_stacked/_time_stacked.tsx
playbook_ui-14.12.0.pre.rc.7 app/pb_kits/playbook/pb_time_stacked/_time_stacked.tsx
playbook_ui-14.11.1.pre.alpha.play1724darkmodeauditmap5437 app/pb_kits/playbook/pb_time_stacked/_time_stacked.tsx
playbook_ui-14.11.1.pre.alpha.PBNTR719listdraggablesimple5432 app/pb_kits/playbook/pb_time_stacked/_time_stacked.tsx
playbook_ui-14.11.1.pre.alpha.PBNTR768stickyrightcolumn5431 app/pb_kits/playbook/pb_time_stacked/_time_stacked.tsx
playbook_ui-14.12.0.pre.rc.6 app/pb_kits/playbook/pb_time_stacked/_time_stacked.tsx
playbook_ui-14.11.1.pre.alpha.PBNTR718simiplifieddraggablereact5415 app/pb_kits/playbook/pb_time_stacked/_time_stacked.tsx
playbook_ui-14.11.1.pre.alpha.play1724darkmodeauditmap5413 app/pb_kits/playbook/pb_time_stacked/_time_stacked.tsx
playbook_ui-14.12.0.pre.rc.5 app/pb_kits/playbook/pb_time_stacked/_time_stacked.tsx
playbook_ui-14.11.1.pre.alpha.play1724darkmodeauditmap5409 app/pb_kits/playbook/pb_time_stacked/_time_stacked.tsx
playbook_ui-14.11.1.pre.alpha.PBNTR718simiplifieddraggablereact5400 app/pb_kits/playbook/pb_time_stacked/_time_stacked.tsx
playbook_ui-14.11.1.pre.alpha.PBNTR718simiplifieddraggablereact5392 app/pb_kits/playbook/pb_time_stacked/_time_stacked.tsx