Sha256: 8a515a92396eb4f94d497f755807eb097496ad8052d46fdfc340b0ee50887c4e
Contents?: true
Size: 1.73 KB
Versions: 10
Compression:
Stored size: 1.73 KB
Contents
import React from 'react' import classnames from 'classnames' import { buildAriaProps, buildCss, buildDataProps, buildHtmlProps } from '../utilities/props' import { globalProps } from '../utilities/globalProps' import Flex from '../pb_flex/_flex' import Time from '../pb_time/_time' import FormattedDate from '../pb_date/_date' type DateTimeProps = { align?: "left" | "center" | "right", aria?: { [key: string]: string; }, className?: string, data?: { [key: string]: string; }, datetime: Date, htmlOptions?: {[key: string]: string | number | boolean | Function}, id?: string, size?: "sm" | "md", showDayOfWeek: boolean, showIcon?: boolean, timeZone?: string } const DateTime = (props: DateTimeProps) => { const { align = 'left', aria = {}, className, data = {}, htmlOptions = {}, showDayOfWeek = false, datetime, id, showIcon = false, size = 'md', timeZone = 'America/New_York', } = props const ariaProps = buildAriaProps(aria) const dataProps = buildDataProps(data) const htmlProps = buildHtmlProps(htmlOptions) const classes = classnames( buildCss('pb_date_time', size), globalProps(props), className ) return ( <div {...ariaProps} {...dataProps} {...htmlProps} className={classes} id={id} > <Flex horizontal={align} vertical="baseline" > <FormattedDate showDayOfWeek={showDayOfWeek} size={size} value={datetime} /> <Time date={datetime} marginLeft="sm" showIcon={showIcon} size={size} timeZone={timeZone} /> </Flex> </div> ) } export default DateTime
Version data entries
10 entries across 10 versions & 1 rubygems