Sha256: 98a6983a1987f860ecdde8be1e0f4a2cf8c0f047ed8d5a3ed2ad96731d3f7e78

Contents?: true

Size: 1.57 KB

Versions: 72

Compression:

Stored size: 1.57 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() //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

72 entries across 72 versions & 1 rubygems

Version Path
playbook_ui-13.9.0.pre.alpha.play978makehighchartsadevdependencypoc1292 app/pb_kits/playbook/pb_time_stacked/_time_stacked.tsx
playbook_ui-13.9.0.pre.alpha.verdaccioregistry1277 app/pb_kits/playbook/pb_time_stacked/_time_stacked.tsx
playbook_ui-13.9.0.pre.alpha.play845addswiftkitspage1273 app/pb_kits/playbook/pb_time_stacked/_time_stacked.tsx
playbook_ui-13.9.0.pre.alpha.play845addswiftkitspage1272 app/pb_kits/playbook/pb_time_stacked/_time_stacked.tsx
playbook_ui-13.9.0.pre.alpha.play845allkitsbytypes1271 app/pb_kits/playbook/pb_time_stacked/_time_stacked.tsx
playbook_ui-13.9.0.pre.alpha.play845allkitsbytypes1270 app/pb_kits/playbook/pb_time_stacked/_time_stacked.tsx
playbook_ui-13.9.0.pre.alpha.play845allkitsbytypes1268 app/pb_kits/playbook/pb_time_stacked/_time_stacked.tsx
playbook_ui-13.9.0.pre.alpha.play845allkitsbytypes1266 app/pb_kits/playbook/pb_time_stacked/_time_stacked.tsx
playbook_ui-13.9.0.pre.alpha.play845allkitsbytypes1264 app/pb_kits/playbook/pb_time_stacked/_time_stacked.tsx
playbook_ui-13.9.0.pre.alpha.play845allkitsbytypes1263 app/pb_kits/playbook/pb_time_stacked/_time_stacked.tsx
playbook_ui-13.9.0.pre.alpha.play845allkitsbytypes1262 app/pb_kits/playbook/pb_time_stacked/_time_stacked.tsx
playbook_ui-13.9.0.pre.alpha.PLAY962SingleSelect1261 app/pb_kits/playbook/pb_time_stacked/_time_stacked.tsx
playbook_ui-13.9.0.pre.alpha.play845allkitsbytypes1260 app/pb_kits/playbook/pb_time_stacked/_time_stacked.tsx
playbook_ui-13.9.0 app/pb_kits/playbook/pb_time_stacked/_time_stacked.tsx
playbook_ui-13.8.0.pre.alpha.play845allkitsbytypes1258 app/pb_kits/playbook/pb_time_stacked/_time_stacked.tsx
playbook_ui-13.8.0.pre.alpha.play845allkitsbytypes1257 app/pb_kits/playbook/pb_time_stacked/_time_stacked.tsx
playbook_ui-13.8.0.pre.alpha.PLAY962SingleSelect1256 app/pb_kits/playbook/pb_time_stacked/_time_stacked.tsx
playbook_ui-13.8.0.pre.alpha.play845allkitsbytypes1255 app/pb_kits/playbook/pb_time_stacked/_time_stacked.tsx
playbook_ui-13.8.0.pre.alpha.play845allkitsbytypes1254 app/pb_kits/playbook/pb_time_stacked/_time_stacked.tsx
playbook_ui-13.8.0.pre.alpha.PLAY962SingleSelect1246 app/pb_kits/playbook/pb_time_stacked/_time_stacked.tsx