laif-ds
Version:
Design System di Laif con componenti React basati su principi di Atomic Design
31 lines (30 loc) • 961 B
JavaScript
"use client";
import { jsxs as c, jsx as o } from "react/jsx-runtime";
import { useCalendar as m } from "./calendar-context.js";
const h = () => {
const {
currentTime: t,
enableGrouping: i,
calendarStartHour: r = 6,
calendarEndHour: s = 18
} = m();
if (!t) return null;
const [e, n] = t.split(":").map(Number);
if (e < r || e > s || e === s && n > 0)
return null;
const l = (e - r) * 60 + n, a = 56 + (i ? 40 : 0), u = 64 / 60, d = a + l * u;
return /* @__PURE__ */ c(
"div",
{
className: "pointer-events-none absolute inset-x-0 z-50",
style: { top: `${d}px` },
children: [
/* @__PURE__ */ o("div", { className: "bg-d-destructive h-0.5 w-full shadow-sm" }),
/* @__PURE__ */ o("div", { className: "bg-d-destructive absolute left-4 -translate-y-1/2 rounded-md px-2 py-0.5 text-xs font-medium text-white shadow-md", children: t })
]
}
);
};
export {
h as CurrentTimeLine
};