Sha256: de5daeb3d35071b7b482c845d942e52719a04644e3f319fee546bc084c3a88e8

Contents?: true

Size: 1.59 KB

Versions: 40

Compression:

Stored size: 1.59 KB

Contents

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

import { buildCss, buildDataProps } 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,
  id?: string,
  time?: number | Date,
  timeZone?: string,
}

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

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

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

  return (
    <div
        className={classes}
        {...dataProps}
    >
      <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

40 entries across 40 versions & 1 rubygems

Version Path
playbook_ui-13.5.0.pre.alpha.PLAY823globalpropoverflow1191 app/pb_kits/playbook/pb_time_stacked/_time_stacked.tsx
playbook_ui-13.5.0.pre.alpha.PLAY823globalpropoverflow1188 app/pb_kits/playbook/pb_time_stacked/_time_stacked.tsx
playbook_ui-13.5.0 app/pb_kits/playbook/pb_time_stacked/_time_stacked.tsx
playbook_ui-13.4.0.pre.alpha.PLAY973Hash1181 app/pb_kits/playbook/pb_time_stacked/_time_stacked.tsx
playbook_ui-13.4.0 app/pb_kits/playbook/pb_time_stacked/_time_stacked.tsx
playbook_ui-13.3.0 app/pb_kits/playbook/pb_time_stacked/_time_stacked.tsx
playbook_ui-13.2.0.pre.alpha.PLAY986dateTimeRounding1150 app/pb_kits/playbook/pb_time_stacked/_time_stacked.tsx
playbook_ui-13.2.0 app/pb_kits/playbook/pb_time_stacked/_time_stacked.tsx
playbook_ui-13.1.0 app/pb_kits/playbook/pb_time_stacked/_time_stacked.tsx
playbook_ui-13.0.0.pre.alpha.PLAY966collapsiblenav41129 app/pb_kits/playbook/pb_time_stacked/_time_stacked.tsx
playbook_ui-13.0.0.pre.alpha.PLAY966collapsiblenav41128 app/pb_kits/playbook/pb_time_stacked/_time_stacked.tsx
playbook_ui-13.0.0.pre.alpha.PLAY966collapsiblenav41126 app/pb_kits/playbook/pb_time_stacked/_time_stacked.tsx
playbook_ui-13.0.0.pre.alpha.salesbookmismatchingdate1120 app/pb_kits/playbook/pb_time_stacked/_time_stacked.tsx
playbook_ui-12.39.0.pre.alpha.salesbookmismatchingdate1117 app/pb_kits/playbook/pb_time_stacked/_time_stacked.tsx
playbook_ui-13.0.0 app/pb_kits/playbook/pb_time_stacked/_time_stacked.tsx
playbook_ui-12.39.0.pre.alpha.PLAY966collapsiblenav41115 app/pb_kits/playbook/pb_time_stacked/_time_stacked.tsx
playbook_ui-12.39.0.pre.alpha.salesbookmismatchingdate1114 app/pb_kits/playbook/pb_time_stacked/_time_stacked.tsx
playbook_ui-12.39.0 app/pb_kits/playbook/pb_time_stacked/_time_stacked.tsx
playbook_ui-12.38.0.pre.alpha.PBNTR78selectkitmultipleprop1094 app/pb_kits/playbook/pb_time_stacked/_time_stacked.tsx
playbook_ui-12.38.0.pre.alpha.PLAY932removemomentqp1088 app/pb_kits/playbook/pb_time_stacked/_time_stacked.tsx