Sha256: 01bf8a3846bc5190e3e77f909692e53d79b0792caded43265e109c219cb3a2fc

Contents?: true

Size: 1.62 KB

Versions: 185

Compression:

Stored size: 1.62 KB

Contents

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

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

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?: string,
  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)

  const dateTimestamp = new DateTime({ value: date ? date : new Date(time), zone: timeZone })

  return (
    <div
        className={classes}
        {...dataProps}
    >
      <Body
          className={classnames('pb_time_stacked', 'time-spacing')}
          color="light"
          dark={dark}
      >
        <time>
          {dateTimestamp.toTimeWithMeridian()}
          <Caption
              className="pb_time_stacked"
              color="light"
              dark={dark}
              tag="span"
              text={dateTimestamp.toTimezone()}
          />
        </time>
      </Body>
    </div>
  )
}

export default TimeStackedDefault

Version data entries

185 entries across 185 versions & 1 rubygems

Version Path
playbook_ui-12.24.0.pre.alpha.play824751 app/pb_kits/playbook/pb_time_stacked/_time_stacked.tsx
playbook_ui-12.24.0.pre.alpha.railsmultilevelimprovements749 app/pb_kits/playbook/pb_time_stacked/_time_stacked.tsx
playbook_ui-12.24.0.pre.alpha.play824745 app/pb_kits/playbook/pb_time_stacked/_time_stacked.tsx
playbook_ui-12.24.0.pre.alpha.railsmultilevelimprovements742 app/pb_kits/playbook/pb_time_stacked/_time_stacked.tsx
playbook_ui-12.24.0.pre.alpha.railsmultilevelimprovements741 app/pb_kits/playbook/pb_time_stacked/_time_stacked.tsx
playbook_ui-12.24.0.pre.alpha.railsmultilevelimprovements739 app/pb_kits/playbook/pb_time_stacked/_time_stacked.tsx
playbook_ui-12.24.0.pre.alpha.play824733 app/pb_kits/playbook/pb_time_stacked/_time_stacked.tsx
playbook_ui-12.24.0.pre.alpha.play833boldoptionfortitle2and3721 app/pb_kits/playbook/pb_time_stacked/_time_stacked.tsx
playbook_ui-12.24.0.pre.alpha.alphatestforselfhostfak720 app/pb_kits/playbook/pb_time_stacked/_time_stacked.tsx
playbook_ui-12.24.0.pre.alpha.play833boldoptionfortitle2and3719 app/pb_kits/playbook/pb_time_stacked/_time_stacked.tsx
playbook_ui-12.24.0.pre.alpha.play833boldoptionfortitle2and3717 app/pb_kits/playbook/pb_time_stacked/_time_stacked.tsx
playbook_ui-12.24.0 app/pb_kits/playbook/pb_time_stacked/_time_stacked.tsx
playbook_ui-12.23.0.pre.alpha.movemarkdown712 app/pb_kits/playbook/pb_time_stacked/_time_stacked.tsx
playbook_ui-12.23.0.pre.alpha.movemarkdown708 app/pb_kits/playbook/pb_time_stacked/_time_stacked.tsx
playbook_ui-12.23.0.pre.alpha.play698responsivespacingglobalprop703 app/pb_kits/playbook/pb_time_stacked/_time_stacked.tsx
playbook_ui-12.23.0.pre.alpha.play698responsivespacingglobalprop701 app/pb_kits/playbook/pb_time_stacked/_time_stacked.tsx
playbook_ui-12.23.0 app/pb_kits/playbook/pb_time_stacked/_time_stacked.tsx
playbook_ui-12.22.0.pre.alpha.PLAY603datepickerquickpickinputpresetdropdown696 app/pb_kits/playbook/pb_time_stacked/_time_stacked.tsx
playbook_ui-12.22.0.pre.alpha.play698responsivespacingglobalprop690 app/pb_kits/playbook/pb_time_stacked/_time_stacked.tsx
playbook_ui-12.22.0.pre.alpha.PBNTR12checkingemptyfilters686 app/pb_kits/playbook/pb_time_stacked/_time_stacked.tsx