2022-12-14 13:36:10 +00:00
|
|
|
import React from "react";
|
|
|
|
|
|
|
|
import dayjs from "@calcom/dayjs";
|
|
|
|
import { classNames } from "@calcom/lib";
|
|
|
|
|
|
|
|
type Props = {
|
|
|
|
days: dayjs.Dayjs[];
|
|
|
|
containerNavRef: React.RefObject<HTMLDivElement>;
|
|
|
|
};
|
|
|
|
|
|
|
|
export function DateValues({ days, containerNavRef }: Props) {
|
|
|
|
return (
|
|
|
|
<div
|
|
|
|
ref={containerNavRef}
|
2023-06-15 09:59:58 +00:00
|
|
|
className="bg-default dark:bg-muted border-b-subtle sticky top-[var(--calendar-dates-sticky-offset,0px)] z-[80] flex-none border-b sm:pr-8">
|
2023-04-05 18:14:46 +00:00
|
|
|
<div className="text-subtle flex text-sm leading-6 sm:hidden" data-dayslength={days.length}>
|
2022-12-14 13:36:10 +00:00
|
|
|
{days.map((day) => {
|
|
|
|
const isToday = dayjs().isSame(day, "day");
|
|
|
|
return (
|
|
|
|
<button
|
|
|
|
key={day.toString()}
|
|
|
|
type="button"
|
2023-06-22 22:25:37 +00:00
|
|
|
className="flex flex-1 flex-col items-center pb-3 pt-2">
|
2022-12-14 13:36:10 +00:00
|
|
|
{day.format("dd")}{" "}
|
|
|
|
<span
|
|
|
|
className={classNames(
|
2023-04-05 18:14:46 +00:00
|
|
|
"text-emphasis mt-1 flex h-8 w-8 items-center justify-center font-semibold",
|
|
|
|
isToday && "bg-inverted text-inverted rounded-full"
|
2022-12-14 13:36:10 +00:00
|
|
|
)}>
|
|
|
|
{day.format("D")}
|
|
|
|
</span>
|
|
|
|
</button>
|
|
|
|
);
|
|
|
|
})}
|
|
|
|
</div>
|
2023-04-05 18:14:46 +00:00
|
|
|
<div className="text-subtle -mr-px hidden auto-cols-fr text-sm leading-6 sm:flex ">
|
2023-06-29 07:47:16 +00:00
|
|
|
<div className="border-default col-end-1 w-14 border-l" />
|
2022-12-14 13:36:10 +00:00
|
|
|
{days.map((day) => {
|
|
|
|
const isToday = dayjs().isSame(day, "day");
|
|
|
|
return (
|
|
|
|
<div
|
|
|
|
key={day.toString()}
|
2023-06-09 09:38:18 +00:00
|
|
|
className={classNames(
|
|
|
|
"flex flex-1 items-center justify-center py-3 text-xs font-medium uppercase",
|
|
|
|
isToday && "font-bold"
|
|
|
|
)}>
|
2022-12-14 13:36:10 +00:00
|
|
|
<span>
|
|
|
|
{day.format("ddd")}{" "}
|
|
|
|
<span
|
|
|
|
className={classNames(
|
|
|
|
"items-center justify-center p-1",
|
2023-07-19 22:32:25 +00:00
|
|
|
isToday && "bg-brand-default text-brand rounded-full"
|
2022-12-14 13:36:10 +00:00
|
|
|
)}>
|
|
|
|
{day.format("DD")}
|
|
|
|
</span>
|
|
|
|
</span>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
})}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|