~samhh/samhh.com

ref: b45ec7f3d978b553f884ce95e94937a5915da1fc samhh.com/src/components/Experience.tsx -rw-r--r-- 783 bytes
b45ec7f3 — Sam A. Horvath-Hunt Update AUR link to include co-maintained 1 year, 2 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import { FunctionComponent, ReactNode } from "react"
import * as O from "fp-ts/Option"
import { constant } from "fp-ts/function"
import formatDate from "date-fns/fp/format"
import * as s from "./Experience.module.css"

const fmt = formatDate("MMMM yyyy")
const fmtCurr = O.fold(constant("Present"), fmt)

type Props = {
  title: string | (() => ReactNode)
  desc: string;
  dates: [Date, Option<Date>]
}

const Experience: FunctionComponent<Props> = props => (
  <div className={s.wrapper}>
    <h2 className={s.infoPrimary}>
      {typeof props.title === "string" ? props.title : props.title()}

      <span className={s.infoSecondary}>
        {fmt(props.dates[0])} - {fmtCurr(props.dates[1])}
      </span>
    </h2>

    <p>{props.desc}</p>
  </div>
)

export default Experience