diff --git a/source/components/big-date.tsx b/source/components/big-date.tsx new file mode 100644 index 0000000..df317be --- /dev/null +++ b/source/components/big-date.tsx @@ -0,0 +1,28 @@ +// Third-party imports. +import {Component} from "preact"; +// First-party imports. +import {type SharedProps} from "./shared.js"; + +export class BigDate extends Component { + render() { + const {today} = this.props; + + const date = [ + ["year", today.date.getFullYear().toString()], + ["month", today.paddedMonth()], + ["day", today.paddedDay()], + ] + .map(([name, value]) => {value}) + // Add a dash between each part of the date. + // eslint-disable-next-line unicorn/no-array-reduce + .reduce((accumulator, current) => ( + <> + {accumulator} + - + {current} + + )); + + return

{date}

; + } +} diff --git a/source/components/shared.ts b/source/components/shared.ts new file mode 100644 index 0000000..132d251 --- /dev/null +++ b/source/components/shared.ts @@ -0,0 +1,5 @@ +import {type DateWrapper} from "../date/date.js"; + +export type SharedProps = { + today: DateWrapper; +};