/* @flow */ import React from 'react' import classnames from 'classnames' import DateTime from '../pb_kit/dateTime.js' import { Body, Caption, Icon, Title } from '../' import { spacing } from '../utilities/spacing.js' const dateString = (value: DateTime) => { const month = value.toMonthNum() const day = value.toDay() return ` ยท ${month}/${day}` } type LogisticProps = { dark?: Boolean, date: String, link?: String, projectName: String, projectNumber: Number, } const Logistic = (props: LogisticProps) => { const { dark = false, date, link, projectName, projectNumber } = props const formattedDate = new DateTime({ value: date }) return (
{` ${projectNumber}`} </When> <Otherwise> <Title size={4} tag="span" text={' ' + projectName} /> </Otherwise> </Choose> </a> </When> <Otherwise> <Choose> <When condition={date}> <Title dark={dark} size={4} tag="span" text={' ' + projectName + dateString(formattedDate)} /> </When> <Otherwise> <Title dark={dark} size={4} tag="span" text={' ' + projectName} /> </Otherwise> </Choose> </Otherwise> </Choose> </Body> </div> ) } export default Logistic