Fixed month calendar grid layout
X-Lovable-Edit-ID: edt-b728fb3a-0269-4421-8ad7-3474e18cd06f Co-authored-by: renee-png <262607627+renee-png@users.noreply.github.com>
This commit is contained in:
@@ -698,14 +698,19 @@ function MonthGrid({
|
||||
const today = new Date();
|
||||
return (
|
||||
<div>
|
||||
<div className="grid grid-cols-7 text-xs font-medium text-muted-foreground border-b">
|
||||
<div
|
||||
className="text-xs font-medium text-muted-foreground border-b"
|
||||
style={{ display: "grid", gridTemplateColumns: "repeat(7, minmax(0, 1fr))" }}
|
||||
>
|
||||
{dayLabels.map((d) => (
|
||||
<div key={d} className="px-2 py-1.5 text-center">
|
||||
{d}
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
<div className="grid grid-cols-7 auto-rows-fr">
|
||||
<div
|
||||
style={{ display: "grid", gridTemplateColumns: "repeat(7, minmax(0, 1fr))", gridAutoRows: "1fr" }}
|
||||
>
|
||||
{days.map((d) => {
|
||||
const key = format(d, "yyyy-MM-dd");
|
||||
const dayEvts = eventsByDay.get(key) ?? [];
|
||||
@@ -717,8 +722,9 @@ function MonthGrid({
|
||||
key={key}
|
||||
onClick={() => onSelectDay(d)}
|
||||
onDoubleClick={() => onCreateOnDay(d)}
|
||||
style={{ minHeight: 100 }}
|
||||
className={cn(
|
||||
"min-h-[100px] border-b border-r p-1.5 cursor-pointer transition-colors",
|
||||
"border-b border-r p-1.5 cursor-pointer transition-colors",
|
||||
"hover:bg-accent/40",
|
||||
!inMonth && "bg-muted/30 text-muted-foreground",
|
||||
isSel && "ring-1 ring-primary ring-inset",
|
||||
@@ -778,7 +784,9 @@ function WeekStrip({
|
||||
}) {
|
||||
const today = new Date();
|
||||
return (
|
||||
<div className="grid grid-cols-7 gap-2">
|
||||
<div
|
||||
style={{ display: "grid", gridTemplateColumns: "repeat(7, minmax(0, 1fr))", gap: "0.5rem" }}
|
||||
>
|
||||
{days.map((d) => {
|
||||
const key = format(d, "yyyy-MM-dd");
|
||||
const dayEvts = eventsByDay.get(key) ?? [];
|
||||
|
||||
Reference in New Issue
Block a user