Home / File/ calendar-custom-days.tsx — ui Source File

calendar-custom-days.tsx — ui Source File

Architecture documentation for calendar-custom-days.tsx, a tsx file in the ui codebase. 5 imports, 0 dependents.

File tsx DocumentationAtlas Changelog 5 imports 1 functions

Entity Profile

Dependency Diagram

graph LR
  a5d39393_e83d_86da_a192_fdaec5b07831["calendar-custom-days.tsx"]
  1d141819_425e_b5fd_4c8e_32f7c6a42cf2["react"]
  a5d39393_e83d_86da_a192_fdaec5b07831 --> 1d141819_425e_b5fd_4c8e_32f7c6a42cf2
  a8023de3_411c_8d95_59e9_37549a0c2d75["calendar"]
  a5d39393_e83d_86da_a192_fdaec5b07831 --> a8023de3_411c_8d95_59e9_37549a0c2d75
  a66f2388_87f1_5188_51e6_9a4b91cfd618["card"]
  a5d39393_e83d_86da_a192_fdaec5b07831 --> a66f2388_87f1_5188_51e6_9a4b91cfd618
  f9e8c1ea_9de4_3e04_ca27_b15cada2e81e["date-fns"]
  a5d39393_e83d_86da_a192_fdaec5b07831 --> f9e8c1ea_9de4_3e04_ca27_b15cada2e81e
  bfc8708c_7488_3983_8998_32b793781735["react-day-picker"]
  a5d39393_e83d_86da_a192_fdaec5b07831 --> bfc8708c_7488_3983_8998_32b793781735
  style a5d39393_e83d_86da_a192_fdaec5b07831 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

"use client"

import * as React from "react"
import { Calendar, CalendarDayButton } from "@/examples/base/ui/calendar"
import { Card, CardContent } from "@/examples/base/ui/card"
import { addDays } from "date-fns"
import { type DateRange } from "react-day-picker"

export function CalendarCustomDays() {
  const [range, setRange] = React.useState<DateRange | undefined>({
    from: new Date(new Date().getFullYear(), 11, 8),
    to: addDays(new Date(new Date().getFullYear(), 11, 8), 10),
  })

  return (
    <Card className="mx-auto w-fit p-0">
      <CardContent className="p-0">
        <Calendar
          mode="range"
          defaultMonth={range?.from}
          selected={range}
          onSelect={setRange}
          numberOfMonths={1}
          captionLayout="dropdown"
          className="[--cell-size:--spacing(10)] md:[--cell-size:--spacing(12)]"
          formatters={{
            formatMonthDropdown: (date) => {
              return date.toLocaleString("default", { month: "long" })
            },
          }}
          components={{
            DayButton: ({ children, modifiers, day, ...props }) => {
              const isWeekend =
                day.date.getDay() === 0 || day.date.getDay() === 6

              return (
                <CalendarDayButton day={day} modifiers={modifiers} {...props}>
                  {children}
                  {!modifiers.outside && (
                    <span>{isWeekend ? "$120" : "$100"}</span>
                  )}
                </CalendarDayButton>
              )
            },
          }}
        />
      </CardContent>
    </Card>
  )
}

Subdomains

Dependencies

  • calendar
  • card
  • date-fns
  • react
  • react-day-picker

Frequently Asked Questions

What does calendar-custom-days.tsx do?
calendar-custom-days.tsx is a source file in the ui codebase, written in tsx. It belongs to the DocumentationAtlas domain, Changelog subdomain.
What functions are defined in calendar-custom-days.tsx?
calendar-custom-days.tsx defines 1 function(s): CalendarCustomDays.
What does calendar-custom-days.tsx depend on?
calendar-custom-days.tsx imports 5 module(s): calendar, card, date-fns, react, react-day-picker.
Where is calendar-custom-days.tsx in the architecture?
calendar-custom-days.tsx is located at apps/v4/examples/base/calendar-custom-days.tsx (domain: DocumentationAtlas, subdomain: Changelog, directory: apps/v4/examples/base).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free