1
mirror of https://github.com/jakejarvis/jarv.is.git synced 2026-06-19 12:15:27 -04:00

Tailwind redesign (#2387)

This commit is contained in:
2025-05-02 22:04:26 -04:00
committed by GitHub
parent c4f67f170b
commit 5058382f71
162 changed files with 2739 additions and 3554 deletions
+24
View File
@@ -0,0 +1,24 @@
"use client";
import { useMountedState } from "react-use";
import TimeAgo from "react-timeago";
import Time from "@/components/time";
import type { ComponentPropsWithoutRef } from "react";
export type RelativeTimeProps = ComponentPropsWithoutRef<"time"> & {
date: string;
};
const RelativeTime = ({ date, ...rest }: RelativeTimeProps) => {
// play nice with SSR -- only use relative time on the client, since it'll quickly become outdated on the server and
// cause a react hydration mismatch error.
const isMounted = useMountedState();
if (!isMounted) {
return <Time date={date} format="MMM d, y" {...rest} />;
}
return <TimeAgo date={date} {...rest} />;
};
export default RelativeTime;