| 1 | import { format, formatDistanceToNow, isPast } from 'date-fns' |
| 2 | import { AlertTriangleIcon, CalendarIcon |
| 3 | import { cn } |
| 4 | |
| 5 | export function ProjectDueDate({ |
| 6 | const overdue = |
| 7 | |
| 8 | return ( |
| 9 | <div |
| 10 | className={cn( |
| 11 | 'inline-flex items-center gap-1.5 rounded-md px-2 py-0.5 font-medium text-xs', |
| 12 | overdue |
| 13 | ? 'bg-destructive/10 text-destructive' |
| 14 | : 'bg-muted text-muted-foreground' |
| 15 | )} |
| 16 | > |
| 17 | {overdue ? ( |
| 18 | <AlertTriangleIcon className=' |
| 19 | ) : ( |
| 20 | <CalendarIcon className=' |
| 21 | )} |
| 22 | {overdue |
| 23 | ? `Overdue by ${formatDistanceToNow( |
| 24 | : `Due ${format( |
| 25 | </div> |
| 26 | ) |
| 27 | } |