1
mirror of https://github.com/jakejarvis/jarv.is.git synced 2025-09-18 16:05:33 -04:00

simplify theme provider

This commit is contained in:
2025-03-01 16:08:12 -05:00
parent 9c4d14fa45
commit 36faa6c234
11 changed files with 99 additions and 120 deletions

View File

@@ -1,14 +1,14 @@
import { formatDate } from "../../lib/helpers/format-date";
import type { ComponentPropsWithoutRef } from "react";
export type TimeProps = {
export type TimeProps = ComponentPropsWithoutRef<"time"> & {
date: string | number | Date;
format?: string;
className?: string;
};
const Time = ({ date, format = "MMM D", className }: TimeProps) => {
const Time = ({ date, format = "MMM D", ...rest }: TimeProps) => {
return (
<time dateTime={formatDate(date)} title={formatDate(date, "MMM D, YYYY, h:mm A z")} className={className}>
<time dateTime={formatDate(date)} title={formatDate(date, "MMM D, YYYY, h:mm A z")} {...rest}>
{formatDate(date, format)}
</time>
);