mirror of
https://github.com/supabase/supabase.git
synced 2026-12-06 08:29:01 +00:00
## What Fixes misaligned day cells in the PITR calendar widget for the first week of the month. ## Why The PITR calendar draws a \`border\` on each day cell via \`classNames.day\`. The day \`<td>\` has no explicit width, so \`box-sizing: border-box\` doesn't apply and the 1px borders add to its size (36px → 38px), while the weekday header cells stay pinned at \`w-9\` (36px). Bordered day cells therefore drift right of their headers, which is most visible in the first partial week where unbordered leading cells sit flush next to the wider bordered ones. ## How Pin each day cell to a fixed \`w-9 box-border\` so the border is drawn inside the 36px box, and let the day button fill the cell (\`w-full\`). Column pitch now matches the weekday headers regardless of border state. Class-only change, no logic touched. Closes FE-3886 <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Style** * Improved calendar day cell sizing and layout for more consistent rendering. * Ensured day buttons use full-width styling where applicable, while preserving existing hover, border, background, and corner behavior. * **Documentation** * Added documentation for “Calendar with disabled days,” including a new interactive preview. * **New Features** * Introduced a calendar example demonstrating disabled-day behavior with mid-week month start and restricted date selection. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Joshen Lim <joshenlimek@gmail.com> Co-authored-by: Ivan Vasilov <vasilov.ivan@gmail.com>
26 lines
644 B
TypeScript
26 lines
644 B
TypeScript
'use client'
|
|
|
|
import * as React from 'react'
|
|
import { Calendar } from 'ui'
|
|
|
|
// The dates are specifically chosen to show a month which starts mid week.
|
|
const latestDate = new Date(2026, 6, 10)
|
|
const earliestDate = new Date(2026, 6, 7)
|
|
|
|
export default function CalendarMidWeekDemo() {
|
|
const [date, setDate] = React.useState<Date | undefined>(earliestDate)
|
|
|
|
return (
|
|
<Calendar
|
|
mode="single"
|
|
required={true}
|
|
selected={date}
|
|
onSelect={setDate}
|
|
defaultMonth={latestDate}
|
|
startMonth={earliestDate}
|
|
endMonth={latestDate}
|
|
disabled={[{ before: earliestDate }, { after: latestDate }]}
|
|
/>
|
|
)
|
|
}
|