-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cal #4859
Open
1amageek
wants to merge
43
commits into
heroui-inc:canary
Choose a base branch
from
1amageek:canary
base: canary
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Cal #4859
Changes from all commits
Commits
Show all changes
43 commits
Select commit
Hold shift + click to select a range
a24b443
feat(calendar): add custom cell content
1amageek 487be5e
refactor(calendar-cell): add useRef hook to improve performance
1amageek 7a0fa5c
refactor: improve CalendarCell by destructuring props and adding type…
1amageek a449568
test(calendar): add test for custom cell content in Calendar and Rang…
1amageek 0218de1
chore: add changeset for custom cell content feature in Calendar and …
1amageek 4d40ddd
refactor: use shared template component for custom cell content in ca…
1amageek c0f2b34
feat: add calendar width and custom cell templates for calendar and r…
1amageek 448ab55
feat(calendar): add renderCellContent prop for custom cell content
1amageek 9445d2b
feat(calendar): move renderCellContent to context
1amageek 930d4af
feat(calendar): add cell components and context management
1amageek 9fc7840
feat(calendar): implement custom cell content rendering
1amageek b327e40
feat(docs): add custom cell content examples for calendar components
1amageek b2fcf12
fix(theme): correct typo in calendar cellBody height class
1amageek 39dd82c
Merge branch 'canary' into canary
1amageek 0f22c26
feat(calendar): add day of week calculation to CalendarCell component
1amageek 2ae85a9
refactor(calendar): improve calendar cell components and remove unuse…
1amageek 01b3ba2
feat(calendar): update components to use CalendarCellHeader
1amageek 874af0b
refactor(theme): update gridBodyRow styles for better spacing
1amageek e814634
refactor(calendar): integrate CalendarCellHeader into calendar cell c…
1amageek 24ccded
feat(calendar): add support for custom cell content in calendar compo…
1amageek 1cd1d21
feat(calendar): add role and aria-label to birthday events
1amageek 8902936
feat(calendar): add calendar cell components and context support
1amageek 84a85d7
feat(calendar): add calendar cell components and context support
1amageek 9e6ca20
feat(calendar): update documentation
1amageek 9091f51
chore: update changelog for calendar customization
1amageek b920894
feat(calendar): add calendar cell
1amageek a16dcf4
fix(calendar): fix conflicts
1amageek 5b46ae7
fix(calendar): fix conflicts
1amageek 6a20973
Merge branch 'canary' into canary
1amageek b62c31c
fix(calendar): calendar-cell-header
1amageek 0d443a0
fix(calendar): heroui
1amageek e405bc4
fix(calendar): remove
1amageek 6c50d3f
fix(calendar): fix changeset
1amageek d051d7f
chore(changeset): change to patch
wingkwong e7f8fc4
Merge branch 'heroui-inc:canary' into canary
1amageek f1c7358
fix(calendar): change to heroui
1amageek 2f1db7d
fix(calendar): fix
1amageek 0406ea2
fix(calandar): fix
1amageek a61859e
Merge branch 'canary' into canary
1amageek e7bc8dc
Update custom-cell-content.raw.jsx
1amageek a4b6ba2
fix(calendar): format
1amageek e6f5f33
fix(calendar): fix
1amageek 2c2b85c
fix(calendar): fix
1amageek File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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,18 @@ | ||
--- | ||
"@heroui/calendar": patch | ||
--- | ||
|
||
### Changes | ||
- Added support for customizing calendar cells. | ||
- You can now use `children` to customize the content of calendar cells. | ||
- The default structure of calendar cells has been updated to improve flexibility. | ||
|
||
```jsx | ||
<Calendar> | ||
{(date) => ( | ||
<div style={{ backgroundColor: "lightblue" }}> | ||
<span>{date.day}</span> | ||
</div> | ||
)} | ||
</Calendar> | ||
``` |
45 changes: 45 additions & 0 deletions
45
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,45 @@ | ||
import React from "react"; | ||
import {Calendar, CalendarCellContent, CalendarCellHeader, CalendarCellBody} from "@heroui/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> | ||
); | ||
} |
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, | ||
}; |
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
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 "@heroui/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> | ||
); | ||
} |
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Eliminate Duplicate Custom Cell Content Section
A nearly identical "Custom Cell Content" section appears again at lines 197-205. This duplication may confuse readers and increase maintenance overhead. Consider consolidating these sections into a single, comprehensive explanation. Additionally, revisiting the punctuation (as noted by static analysis) could further enhance clarity.
Suggested diff to remove duplicate block:
🧰 Tools
🪛 LanguageTool
[uncategorized] ~205-~205: Loose punctuation mark.
Context: ... customization: -
CalendarCellContent
: The wrapper component for the cell cont...(UNLIKELY_OPENING_PUNCTUATION)