Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
159 changes: 82 additions & 77 deletions components/ui/8bit/calendar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,83 +51,88 @@ function Calendar({ className, classNames, font, ...props }: CalendarProps) {
...classNames,
}}
components={{
IconLeft: ({ className, ...props }) => (
<svg
viewBox="0 0 256 256"
fill="currentColor"
xmlns="http://www.w3.org/2000/svg"
stroke="currentColor"
strokeWidth="0.25"
color=""
className={cn("size-4 shrink-0", className)}
aria-label="chevron-left"
{...props}
>
<rect
width="14"
height="14"
rx="1"
transform="matrix(-1 0 0 1 128 136)"
></rect>
<rect
width="14"
height="14"
rx="1"
transform="matrix(-1 0 0 1 144 152)"
></rect>
<rect
width="14"
height="14"
rx="1"
transform="matrix(-1 0 0 1 160 72)"
></rect>
<rect
width="14"
height="14"
rx="1"
transform="matrix(-1 0 0 1 160 168)"
></rect>
<rect
width="14"
height="14"
rx="1"
transform="matrix(-1 0 0 1 112 120)"
></rect>
<rect
width="14"
height="14"
rx="1"
transform="matrix(-1 0 0 1 128 104)"
></rect>
<rect
width="14"
height="14"
rx="1"
transform="matrix(-1 0 0 1 144 88)"
></rect>
</svg>
),
IconRight: ({ className, ...props }) => (
<svg
viewBox="0 0 256 256"
fill="currentColor"
xmlns="http://www.w3.org/2000/svg"
stroke="currentColor"
strokeWidth="0.25"
color=""
className={cn("size-4 shrink-0", className)}
aria-label="chevron-right"
{...props}
>
<rect x="128" y="136" width="14" height="14" rx="1"></rect>
<rect x="112" y="152" width="14" height="14" rx="1"></rect>
<rect x="96" y="72" width="14" height="14" rx="1"></rect>
<rect x="96" y="168" width="14" height="14" rx="1"></rect>
<rect x="144" y="120" width="14" height="14" rx="1"></rect>
<rect x="128" y="104" width="14" height="14" rx="1"></rect>
<rect x="112" y="88" width="14" height="14" rx="1"></rect>
</svg>
),
Chevron: ({ className, ...props }) => {
if (props.orientation === "left") {
return (
<svg
viewBox="0 0 256 256"
fill="currentColor"
xmlns="http://www.w3.org/2000/svg"
stroke="currentColor"
strokeWidth="0.25"
color=""
className={cn("size-4 shrink-0", className)}
aria-label="chevron-left"
{...props}
>
Comment on lines +54 to +67
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Avoid leaking orientation onto the rendered <svg> element

orientation is currently buried inside props, then spread onto the <svg>.
React will pass it through as an unknown DOM attribute (orientation="left" / "right"), which is invalid HTML and needlessly inflates the markup.

- Chevron: ({ className, ...props }) => {
-   if (props.orientation === "left") {
+ Chevron: ({ className, orientation, ...props }) => {
+   if (orientation === "left") {-       {...props}
+       {...props}
     >

Extracting the variable keeps the public signature intact while preventing the stray attribute from ever reaching the DOM.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
Chevron: ({ className, ...props }) => {
if (props.orientation === "left") {
return (
<svg
viewBox="0 0 256 256"
fill="currentColor"
xmlns="http://www.w3.org/2000/svg"
stroke="currentColor"
strokeWidth="0.25"
color=""
className={cn("size-4 shrink-0", className)}
aria-label="chevron-left"
{...props}
>
Chevron: ({ className, orientation, ...props }) => {
if (orientation === "left") {
return (
<svg
viewBox="0 0 256 256"
fill="currentColor"
xmlns="http://www.w3.org/2000/svg"
stroke="currentColor"
strokeWidth="0.25"
color=""
className={cn("size-4 shrink-0", className)}
aria-label="chevron-left"
{...props}
>
🤖 Prompt for AI Agents
In components/ui/8bit/calendar.tsx around lines 54 to 67, the orientation prop
is being spread onto the SVG element, causing an invalid HTML attribute to
appear in the DOM. To fix this, destructure orientation from props before
spreading the remaining props onto the SVG, so orientation is used internally
but not passed as an attribute to the SVG element.

<rect
width="14"
height="14"
rx="1"
transform="matrix(-1 0 0 1 128 136)"
></rect>
<rect
width="14"
height="14"
rx="1"
transform="matrix(-1 0 0 1 144 152)"
></rect>
<rect
width="14"
height="14"
rx="1"
transform="matrix(-1 0 0 1 160 72)"
></rect>
<rect
width="14"
height="14"
rx="1"
transform="matrix(-1 0 0 1 160 168)"
></rect>
<rect
width="14"
height="14"
rx="1"
transform="matrix(-1 0 0 1 112 120)"
></rect>
<rect
width="14"
height="14"
rx="1"
transform="matrix(-1 0 0 1 128 104)"
></rect>
<rect
width="14"
height="14"
rx="1"
transform="matrix(-1 0 0 1 144 88)"
></rect>
</svg>
);
}

return (
<svg
viewBox="0 0 256 256"
fill="currentColor"
xmlns="http://www.w3.org/2000/svg"
stroke="currentColor"
strokeWidth="0.25"
color=""
className={cn("size-4 shrink-0", className)}
aria-label="chevron-right"
{...props}
>
<rect x="128" y="136" width="14" height="14" rx="1"></rect>
<rect x="112" y="152" width="14" height="14" rx="1"></rect>
<rect x="96" y="72" width="14" height="14" rx="1"></rect>
<rect x="96" y="168" width="14" height="14" rx="1"></rect>
<rect x="144" y="120" width="14" height="14" rx="1"></rect>
<rect x="128" y="104" width="14" height="14" rx="1"></rect>
<rect x="112" y="88" width="14" height="14" rx="1"></rect>
</svg>
);
},
}}
{...props}
/>
Expand Down
Loading