1
Fork 0

Compare commits

..

2 Commits

Author SHA1 Message Date
Bauke 35b156ba5a
Remove import comments. 2023-06-04 12:19:27 +02:00
Bauke 5969b023bb
Add the BigDate component. 2023-06-04 12:18:23 +02:00
5 changed files with 31 additions and 8 deletions

View File

@ -1,12 +1,9 @@
// Import native Node libraries.
import path from "node:path"; import path from "node:path";
import process from "node:process"; import process from "node:process";
import fsp from "node:fs/promises"; import fsp from "node:fs/promises";
// Import Esbuild and associated plugins.
import esbuild from "esbuild"; import esbuild from "esbuild";
import copyPlugin from "esbuild-copy-static-files"; import copyPlugin from "esbuild-copy-static-files";
import {sassPlugin} from "esbuild-sass-plugin"; import {sassPlugin} from "esbuild-sass-plugin";
// Import PostCSS and associated plugins.
import cssnano from "cssnano"; import cssnano from "cssnano";
import postcss from "postcss"; import postcss from "postcss";

View File

@ -0,0 +1,26 @@
import {Component} from "preact";
import {type SharedProps} from "./shared.js";
export class BigDate extends Component<SharedProps> {
render() {
const {today} = this.props;
const date = [
["year", today.date.getFullYear().toString()],
["month", today.paddedMonth()],
["day", today.paddedDay()],
]
.map(([name, value]) => <span class={name}>{value}</span>)
// Add a dash between each part of the date.
// eslint-disable-next-line unicorn/no-array-reduce
.reduce((accumulator, current) => (
<>
{accumulator}
<span class="dash">-</span>
{current}
</>
));
return <h1 class="big-date">{date}</h1>;
}
}

View File

@ -0,0 +1,5 @@
import {type DateWrapper} from "../date/date.js";
export type SharedProps = {
today: DateWrapper;
};

View File

@ -1,6 +1,4 @@
// Third-party imports.
import {setup} from "@holllo/test"; import {setup} from "@holllo/test";
// First-party imports.
import {DateWrapper} from "./date.js"; import {DateWrapper} from "./date.js";
await setup("DateWrapper", async (group) => { await setup("DateWrapper", async (group) => {

View File

@ -1,9 +1,6 @@
// Third-party imports.
import {render} from "preact"; import {render} from "preact";
// CSS imports.
import "modern-normalize/modern-normalize.css"; import "modern-normalize/modern-normalize.css";
import "./global.scss"; import "./global.scss";
// First-party imports.
import {App} from "./app.js"; import {App} from "./app.js";
if ($dev) { if ($dev) {