-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(calendar): use React components for calendar cell content
- Loading branch information
Showing
10 changed files
with
128 additions
and
154 deletions.
There are no files selected for viewing
50 changes: 50 additions & 0 deletions
50
apps/docs/content/components/calendar/custom-cell-content.raw.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import React from "react"; | ||
import { | ||
Calendar, | ||
CalendarCellContent, | ||
CalendarCellHeader, | ||
CalendarCellBody, | ||
} from "@nextui-org/react"; | ||
|
||
export default function App() { | ||
return ( | ||
<Calendar calendarWidth={400}> | ||
{(date) => ( | ||
<CalendarCellContent> | ||
<CalendarCellHeader /> | ||
<CalendarCellBody> | ||
<div className="flex flex-col w-full text-tiny gap-0.5 px-0.5"> | ||
{date.day % 7 === 0 && ( | ||
<span | ||
aria-label="Calendar event" | ||
className="bg-red-500/20 w-full rounded-md px-1 text-red-400 line-clamp-1" | ||
role="status" | ||
> | ||
MTG | ||
</span> | ||
)} | ||
{date.day % 5 === 0 && ( | ||
<span | ||
aria-label="calendar event" | ||
className="bg-green-500/20 w-full rounded-md px-1 text-green-400 line-clamp-1" | ||
role="status" | ||
> | ||
MTG | ||
</span> | ||
)} | ||
{date.day % 3 === 0 && ( | ||
<span | ||
aria-label="calendar event" | ||
className="bg-yellow-500/20 w-full rounded-md px-1 text-yellow-400 line-clamp-1" | ||
role="status" | ||
> | ||
MTG | ||
</span> | ||
)} | ||
</div> | ||
</CalendarCellBody> | ||
</CalendarCellContent> | ||
)} | ||
</Calendar> | ||
); | ||
} |
72 changes: 0 additions & 72 deletions
72
apps/docs/content/components/calendar/custom-cell-content.ts
This file was deleted.
Oops, something went wrong.
9 changes: 9 additions & 0 deletions
9
apps/docs/content/components/calendar/custom-cell-content.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import App from "./custom-cell-content.raw.jsx?raw"; | ||
|
||
const react = { | ||
"/App.jsx": App, | ||
}; | ||
|
||
export default { | ||
...react, | ||
}; |
49 changes: 49 additions & 0 deletions
49
apps/docs/content/components/range-calendar/custom-cell-content.raw.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import { | ||
RangeCalendar, | ||
CalendarCellContent, | ||
CalendarCellHeader, | ||
CalendarCellBody, | ||
} from "@nextui-org/react"; | ||
|
||
export default function App() { | ||
return ( | ||
<RangeCalendar calendarWidth={400}> | ||
{(date) => ( | ||
<CalendarCellContent> | ||
<CalendarCellHeader /> | ||
<CalendarCellBody> | ||
<div className="flex flex-col w-full text-tiny gap-0.5 px-0.5"> | ||
{date.day % 7 === 0 && ( | ||
<span | ||
aria-label="calendar event" | ||
className="bg-red-500/20 w-full rounded-md px-1 text-red-400 line-clamp-1" | ||
role="status" | ||
> | ||
MTG | ||
</span> | ||
)} | ||
{date.day % 5 === 0 && ( | ||
<span | ||
aria-label="calendar event" | ||
className="bg-green-500/20 w-full rounded-md px-1 text-green-400 line-clamp-1" | ||
role="status" | ||
> | ||
MTG | ||
</span> | ||
)} | ||
{date.day % 3 === 0 && ( | ||
<span | ||
aria-label="calendar event" | ||
className="bg-yellow-500/20 w-full rounded-md px-1 text-yellow-400 line-clamp-1" | ||
role="status" | ||
> | ||
MTG | ||
</span> | ||
)} | ||
</div> | ||
</CalendarCellBody> | ||
</CalendarCellContent> | ||
)} | ||
</RangeCalendar> | ||
); | ||
} |
72 changes: 0 additions & 72 deletions
72
apps/docs/content/components/range-calendar/custom-cell-content.ts
This file was deleted.
Oops, something went wrong.
9 changes: 9 additions & 0 deletions
9
apps/docs/content/components/range-calendar/custom-cell-content.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import App from "./custom-cell-content.raw.jsx?raw"; | ||
|
||
const react = { | ||
"/App.jsx": App, | ||
}; | ||
|
||
export default { | ||
...react, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters