Sha256: 740770d8a9b7cae1eacc2f7875a56f7c99f3c2a88c45c5a4ba21b372403ac8b4
Contents?: true
Size: 1.44 KB
Versions: 7
Compression:
Stored size: 1.44 KB
Contents
/* @flow */ import React from 'react' import classnames from 'classnames' import DateTime from '../pb_kit/dateTime.js' import { buildCss } from '../utilities/props' import { Caption, Title } from '../' import { globalProps } from '../utilities/globalProps.js' type DateStackedProps = { align?: "left" | "center" | "right", className?: String | Array<String>, dark?: Boolean, data?: String, date: String, size?: "sm" | "md", id?: String, reverse?: Boolean, } const sizes = { sm: 4, md: 3, } const DateStacked = (props: DateStackedProps) => { const { align = 'left', reverse = false, className, dark = false, date, size = 'sm', } = props const classes = classnames( className, buildCss('pb_date_stacked_kit', align, size, { dark: dark, reverse: reverse, }), globalProps(props) ) const currentYear = new Date().getFullYear().toString() const dateTimestamp = new DateTime({ value: date }) const inputYear = dateTimestamp.toYear().toString() return ( <div className={classes}> <div className="pb_date_stacked_day_month"> <Caption text={dateTimestamp.toMonth().toUpperCase()} /> <Title dark={dark} size={sizes[size]} text={dateTimestamp.toDay()} /> </div> <If condition={currentYear != inputYear}> <Caption size="xs">{inputYear}</Caption> </If> </div> ) } export default DateStacked
Version data entries
7 entries across 7 versions & 1 rubygems