feat: update configuration, styles, and components for improved UI and functionality
This commit is contained in:
parent
a3294a0648
commit
1ce743e06a
8 changed files with 118 additions and 70 deletions
26
src/components/dday.tsx
Normal file
26
src/components/dday.tsx
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
"use client";
|
||||
|
||||
interface DDayComponentProps {
|
||||
targetDate: Date;
|
||||
label: string;
|
||||
|
||||
}
|
||||
|
||||
export default function DDayComponent({ targetDate, label }: DDayComponentProps) {
|
||||
const today = new Date();
|
||||
const diffTime = targetDate.getTime() - today.getTime();
|
||||
const diffDays = Math.ceil(diffTime / (1000 * 60 * 60 * 24));
|
||||
|
||||
const getLabel = () => {
|
||||
if (diffDays > 0) return `D-${diffDays}`;
|
||||
if (diffDays < 0) return `D+${Math.abs(diffDays)}`;
|
||||
return `D-Day`;
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="flex flex-col items-end text-right text-sm">
|
||||
<span>{getLabel()}</span>
|
||||
<span className="text-muted-foreground">{label} | {targetDate.toDateString()}</span>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue