dishplanner/frontend-old/app/components/features/schedule/dayCard/DateBadge.tsx

27 lines
844 B
TypeScript
Raw Normal View History

2025-10-13 14:57:11 +02:00
import {DateTime} from "luxon";
2025-11-09 13:09:22 +01:00
import React from "react";
2025-10-13 14:57:11 +02:00
import classNames from "classnames";
interface Props {
date: string
className?: string;
}
2025-11-09 13:09:22 +01:00
const DateBadge = ({ className, date }: Props) => {
2025-10-13 14:57:11 +02:00
const isToday = DateTime.fromISO(date).toFormat("yyyy-LL-dd") == DateTime.now().toFormat("yyyy-LL-dd")
const textStyle = classNames("inline font-bold", {
'text-accent-blue': isToday,
2025-10-13 14:57:11 +02:00
'text-secondary': !isToday,
}, className)
return (
<div className="flex-none w-20 text-center my-auto pb-3 px-3">
<div className={classNames(textStyle, 'text-3xl')}>{DateTime.fromISO(date).toFormat("dd")}</div>
<br/>
<div className={classNames(textStyle, 'text-xl uppercase')}>{DateTime.fromISO(date).toFormat("LLL")}</div>
</div>
)
}
export default DateBadge