Skip to content

Card#41

Merged
toto04 merged 31 commits into
mainfrom
Diubii/card
Apr 22, 2026
Merged

Card#41
toto04 merged 31 commits into
mainfrom
Diubii/card

Conversation

@Diubii

@Diubii Diubii commented Mar 11, 2026

Copy link
Copy Markdown
Contributor

Closes #14

@Diubii Diubii self-assigned this Mar 11, 2026
@coderabbitai

coderabbitai Bot commented Mar 11, 2026

Copy link
Copy Markdown
Contributor

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Walkthrough

Adds a foundational Card UI module (Card + slot subcomponents) and four new presentational card components: CardCaption, CardCourse, CardCourseGroup (with CVA variants), and CardPathSelection. All components are UI-only; no network calls or side-effecting runtime changes were introduced. (33 words)

Changes

Cohort / File(s) Summary
Base Card System
src/components/ui/card.tsx
Introduce Card built on Glass plus slot subcomponents: CardHeader, CardTitle, CardDescription, CardAction, CardContent, CardBottomButton. Adds size prop, hoverBackground, data-slot markers, size-dependent spacing, merged className handling, and optional SVG gradient icon rendering via React.useId().
Caption Card
src/components/card-caption.tsx
New CardCaption component exporting a presentational card that accepts title, caption, optional icon and iconPosition ("top"
Course Card
src/components/card-course.tsx
New CardCourse component rendering course name, location row (with iconLocation), language row (with iconLanguage), and trailing select action (iconSelect). location and language props are narrow unions with defaults; icon props typed as IconType.
Course Group Card
src/components/card-course-group.tsx
New cardCourseGroupVariants (CVA) and CardCourseGroup component. Props include groupName, hasWhatsapp/hasTelegram (defaults true), overrideable icon components, and secondary variant which controls container styling and action class names.
Path Selection Card
src/components/card-path-selection.tsx
New CardPathSelection component: compact fixed-size card taking caption and optional icon (default BsBook), rendering centered, non-wrapping caption with a small icon action.

Possibly related PRs

  • feat: add card-course #63: Adds/updates similar Card UI primitives and presentational card components that overlap with src/components/ui/card.tsx, CardCourse, and CardCourseGroup.
🚥 Pre-merge checks | ✅ 1 | ❌ 3

❌ Failed checks (1 warning, 2 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title 'Card' is vague and generic, using a non-descriptive term that does not convey meaningful information about the specific changes in this changeset. Provide a more specific title that describes the main purpose, such as 'Add Card component with variants and subcomponents' or 'Implement Card UI component system'.
Linked Issues check ❓ Inconclusive The linked issue #14 contains no detailed objectives or requirements to validate against the code changes. Verify the requirements from issue #14 directly. The PR introduces a Card component system with variants and multiple derived components, but cannot confirm compliance without issue details.
✅ Passed checks (1 passed)
Check name Status Explanation
Out of Scope Changes check ✅ Passed All changes are directly related to implementing a Card component system and derived components, with no unrelated modifications detected.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@Diubii Diubii changed the title Card CardCaption Mar 17, 2026
@Diubii Diubii changed the title CardCaption Card Mar 17, 2026
Diubii added 18 commits April 2, 2026 14:17
* created cardCaption.tsx

* Updated card-caption to use react-icons

* Adjusted font sizes

* Updated card-caption to use react-icons

* Adjusted font sizes

* chore: biome

* feat: typography

* aligned card.tsx between all cards

* fix: homepage cards layout

* chore: biome
* created cardCaption.tsx

* Updated card-caption to use react-icons

* Adjusted font sizes

* Added path selection cards

* chore: biome

* Updated card-caption to use react-icons

* Adjusted font sizes

* Added path selection cards

* chore: biome

* rm: card-caption from this branch

* fix: typography

* fix: imports and home layout

* remove: bg-background-blur
* feat: card-groups initial commit

* fix: spacing between elements

* chore: biome

* fix: homepage layout for cards

* remove: bg-background-blur

* chore: biome
* feat: card-course-group initial commit

* chore: biome

* fix: make text and icons black

* feat: added cards to homepage; feat: added bg-background-blur to the card

* remove: bg-background-blur

* remove: truncate class

* feat: secondary variant

* chore: biome

* chore: biome
@Diubii
Diubii marked this pull request as ready for review April 9, 2026 19:42

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (3)
src/components/card-course-group.tsx (1)

42-57: Extract duplicated action styling into one variable.

The two CardAction branches repeat the same class computation; extracting it will simplify future style changes.

Proposed patch
 export function CardCourseGroup({
@@
 } & VariantProps<typeof cardCourseGroupVariants>) {
+  const actionClassName = cn("rounded-full p-3.75", secondary ? "bg-[`#51A2FF`]" : "bg-[`#74D4FF`]")
+
   return (
     <Card className={cn(cardCourseGroupVariants({ secondary }))}>
@@
       {hasWhatsapp && (
         <CardAction
           gradient={false}
-          className={cn("rounded-full p-3.75", secondary ? "bg-[`#51A2FF`]" : "bg-[`#74D4FF`]")}
+          className={actionClassName}
           icon={IconWhatsApp}
           iconSize="normal"
         />
       )}
       {hasTelegram && (
         <CardAction
           gradient={false}
-          className={cn("rounded-full p-3.75", secondary ? "bg-[`#51A2FF`]" : "bg-[`#74D4FF`]")}
+          className={actionClassName}
           icon={IconTelegram}
           iconSize="normal"
         />
       )}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/components/card-course-group.tsx` around lines 42 - 57, The two
CardAction render branches duplicate the same className computation; extract the
computed class into a local variable (e.g., actionClass) before the JSX and use
it for both CardAction components so future style changes are in one place.
Compute actionClass using the existing cn call and the secondary prop logic (the
same expression used now for className), then replace className={cn(...)} in
both CardAction usages with className={actionClass}; keep all other props
(gradient, icon, iconSize) unchanged and reference hasWhatsapp and hasTelegram
as before.
src/components/card-path-selection.tsx (1)

12-12: TODO left in component source.

Line 12 still has an inline TODO (add hover effect). If this is post-MVP work, consider opening a follow-up issue and referencing it here.

If useful, I can draft the hover-state implementation and a small issue template for it.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/components/card-path-selection.tsx` at line 12, Remove the inline TODO
comment "//TODO: add hover effect" from the CardPathSelection component and
either implement a minimal hover state now or replace the TODO with a one-line
task reference to a created follow-up issue (e.g., "TODO: see ISSUE-123 for
hover-state work") so the codebase contains no dangling todos; locate the
comment in the CardPathSelection component (card-path-selection.tsx) and update
the file to either implement the hover effect in the component's styles/JSX or
annotate the TODO with the issue ID and a short note about scope (post-MVP).
src/components/ui/card.tsx (1)

61-61: Make iconSize optional in the prop type to match the default.

iconSize has a runtime default of "normal" (line 58) but the type (line 61) requires it, making the API stricter than necessary.

Proposed patch
-}: React.ComponentProps<"div"> & { icon: IconType; iconSize: "small" | "normal" | "large"; gradient?: boolean }) {
+}: React.ComponentProps<"div"> & { icon: IconType; iconSize?: "small" | "normal" | "large"; gradient?: boolean }) {
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/components/ui/card.tsx` at line 61, The prop type currently requires
iconSize even though the component assigns a default of "normal"; make iconSize
optional in the component's props type by changing the declaration for iconSize
to iconSize?: "small" | "normal" | "large" so the runtime default (set near line
58) matches the TypeScript type—update the props object/type used in the
function signature in src/components/ui/card.tsx (the iconSize prop)
accordingly.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/components/ui/card.tsx`:
- Around line 71-73: The non-visual SVG that defines the gradient (the <svg>
using gradientId) is currently reachable by assistive tech; update that SVG to
be ignored by screen readers by adding aria-hidden="true" and
role="presentation" (and focusable="false" for IE/SVG compatibility) and remove
the <title> element so it won't be announced; locate the SVG in
src/components/ui/card.tsx around the gradientId usage and apply those
attributes and remove the title element.

---

Nitpick comments:
In `@src/components/card-course-group.tsx`:
- Around line 42-57: The two CardAction render branches duplicate the same
className computation; extract the computed class into a local variable (e.g.,
actionClass) before the JSX and use it for both CardAction components so future
style changes are in one place. Compute actionClass using the existing cn call
and the secondary prop logic (the same expression used now for className), then
replace className={cn(...)} in both CardAction usages with
className={actionClass}; keep all other props (gradient, icon, iconSize)
unchanged and reference hasWhatsapp and hasTelegram as before.

In `@src/components/card-path-selection.tsx`:
- Line 12: Remove the inline TODO comment "//TODO: add hover effect" from the
CardPathSelection component and either implement a minimal hover state now or
replace the TODO with a one-line task reference to a created follow-up issue
(e.g., "TODO: see ISSUE-123 for hover-state work") so the codebase contains no
dangling todos; locate the comment in the CardPathSelection component
(card-path-selection.tsx) and update the file to either implement the hover
effect in the component's styles/JSX or annotate the TODO with the issue ID and
a short note about scope (post-MVP).

In `@src/components/ui/card.tsx`:
- Line 61: The prop type currently requires iconSize even though the component
assigns a default of "normal"; make iconSize optional in the component's props
type by changing the declaration for iconSize to iconSize?: "small" | "normal" |
"large" so the runtime default (set near line 58) matches the TypeScript
type—update the props object/type used in the function signature in
src/components/ui/card.tsx (the iconSize prop) accordingly.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 18c9061f-6b8d-49fc-9473-f3348ab7ba50

📥 Commits

Reviewing files that changed from the base of the PR and between 615d1bd and cd4e805.

📒 Files selected for processing (5)
  • src/components/card-caption.tsx
  • src/components/card-course-group.tsx
  • src/components/card-course.tsx
  • src/components/card-path-selection.tsx
  • src/components/ui/card.tsx

Comment thread src/components/ui/card.tsx Outdated
@Diubii

Diubii commented Apr 9, 2026

Copy link
Copy Markdown
Contributor Author

Ci sarà da aggiungere l'hover effect di @BIA3IA

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

♻️ Duplicate comments (1)
src/components/ui/card.tsx (1)

71-73: ⚠️ Potential issue | 🟡 Minor

Finish the decorative SVG accessibility cleanup.

Line 72 still includes a <title> inside the non-visual gradient helper SVG. Since this SVG is decorative, remove the title and mark it presentational to avoid assistive-tech noise.

Suggested patch
-        <svg width="0" height="0" className="absolute" aria-hidden="true" focusable="false">
-          <title>Icon gradient helper</title>
+        <svg width="0" height="0" className="absolute" aria-hidden="true" role="presentation" focusable="false">
           <linearGradient id={gradientId} x1="0%" y1="100%" x2="0%" y2="0%">
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/components/ui/card.tsx` around lines 71 - 73, Remove the non‑visual
<title> element from the decorative SVG and mark the SVG as presentational:
delete the <title> line and add role="presentation" to the <svg> element (the
element that uses gradientId in src/components/ui/card.tsx) while keeping
aria-hidden="true" and focusable="false".
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Duplicate comments:
In `@src/components/ui/card.tsx`:
- Around line 71-73: Remove the non‑visual <title> element from the decorative
SVG and mark the SVG as presentational: delete the <title> line and add
role="presentation" to the <svg> element (the element that uses gradientId in
src/components/ui/card.tsx) while keeping aria-hidden="true" and
focusable="false".

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: c91ffba4-2ea5-4b78-b746-071cd3ffa9b0

📥 Commits

Reviewing files that changed from the base of the PR and between cd4e805 and 1fbb836.

📒 Files selected for processing (2)
  • src/components/card-course-group.tsx
  • src/components/ui/card.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/components/card-course-group.tsx

@lorenzocorallo
lorenzocorallo self-requested a review April 9, 2026 22:27

@toto04 toto04 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

due commentini tanto i componenti li ho già visti nelle singole PR

Comment thread src/components/ui/card.tsx Outdated
Comment thread src/components/card-path-selection.tsx Outdated
@Diubii

Diubii commented Apr 14, 2026

Copy link
Copy Markdown
Contributor Author

Okk, stasera procedo con le modifiche

@Diubii
Diubii requested a review from toto04 April 14, 2026 19:25
@Diubii

Diubii commented Apr 14, 2026

Copy link
Copy Markdown
Contributor Author

Fatto, scusate per il ritardo. Bisogna cambiare qualcosa riguardo la struttura della directory dei components? Vedo che Bianca sta creando nuove cartelle per i suoi, per ora io ho card.tsx sotto components/ui mentre i derivati sotto components.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
src/components/ui/card.tsx (1)

44-53: Use heading semantics for CardTitle instead of a generic div.

CardTitle is a structural title component; using a heading element improves navigation for assistive tech and document outline quality.

Proposed refactor
-function CardTitle({ gradient = true, className, ...props }: React.ComponentProps<"div"> & { gradient?: boolean }) {
+function CardTitle({ gradient = true, className, ...props }: React.ComponentProps<"h3"> & { gradient?: boolean }) {
   return (
-    <div
+    <h3
       data-slot="card-title"
       className={cn(
         `${gradient ? "bg-linear-to-b from-blue-secondary to-blue-primary bg-clip-text text-transparent" : ""} font-medium text-[1.5rem] leading-snug group-data-[size=sm]/card:text-base`,
         className
       )}
       {...props}
-    />
+    />
   )
 }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/components/ui/card.tsx` around lines 44 - 53, CardTitle currently renders
a non-semantic div; change it to render a semantic heading (e.g., <h3>) to
improve accessibility and document outline. Update the component signature from
React.ComponentProps<"div"> to React.ComponentProps<"h3"> (or accept an `as`
prop if you need flexible heading levels), replace the <div
data-slot="card-title"> with the chosen heading element while preserving
className, gradient logic, and spreading {...props}, and ensure any callers'
props align with the new heading prop types.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/components/ui/card.tsx`:
- Around line 16-27: The Card root (<Glass ...>) lacks positioning so
CardHoverBackground (which uses absolute inset-0) won't anchor to it; update the
className passed to Glass in the Card component to include "relative" (ensure
the cn(...) string for the Glass element includes "relative") so
CardHoverBackground is positioned correctly relative to Card.

---

Nitpick comments:
In `@src/components/ui/card.tsx`:
- Around line 44-53: CardTitle currently renders a non-semantic div; change it
to render a semantic heading (e.g., <h3>) to improve accessibility and document
outline. Update the component signature from React.ComponentProps<"div"> to
React.ComponentProps<"h3"> (or accept an `as` prop if you need flexible heading
levels), replace the <div data-slot="card-title"> with the chosen heading
element while preserving className, gradient logic, and spreading {...props},
and ensure any callers' props align with the new heading prop types.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: b78a5cd5-14f3-419c-a53d-fa3182089ef6

📥 Commits

Reviewing files that changed from the base of the PR and between 3b6aa56 and 0661f54.

📒 Files selected for processing (3)
  • src/components/card-caption.tsx
  • src/components/card-path-selection.tsx
  • src/components/ui/card.tsx
✅ Files skipped from review due to trivial changes (2)
  • src/components/card-path-selection.tsx
  • src/components/card-caption.tsx

Comment thread src/components/ui/card.tsx
@Diubii

Diubii commented Apr 16, 2026

Copy link
Copy Markdown
Contributor Author

Correggo i nomi dei commit perché mi ha tagliato via le parole dentro l'accento dei codeblock (`)

  1. feat: add class relative to card.tsx
  2. feat: CardTitle is now h3

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
src/components/ui/card.tsx (1)

61-90: Remove children from CardAction props type to prevent silent drops.

React.ComponentProps<"div"> allows children, but this component always renders its own SVG and icon children, so caller-provided children would be silently ignored. All current usages are self-closing or empty tags, so tightening the API would have no impact but would clarify intent and prevent future misuse.

Proposed fix
+type CardActionProps = Omit<React.ComponentProps<"div">, "children"> & {
+  icon: IconType
+  iconSize?: "small" | "normal" | "large"
+  gradient?: boolean
+}
+
 function CardAction({
   className,
   icon: Icon,
   iconSize = "normal",
   gradient = true,
   ...props
-}: React.ComponentProps<"div"> & { icon: IconType; iconSize?: "small" | "normal" | "large"; gradient?: boolean }) {
+}: CardActionProps) {
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/components/ui/card.tsx` around lines 61 - 90, The CardAction component's
props type currently extends React.ComponentProps<"div"> which includes children
and allows callers to pass children that will be ignored; update the CardAction
props to exclude children by replacing the props type (used in the CardAction
signature) with a custom type that omits "children" (e.g.,
Omit<React.ComponentProps<"div">, "children"> & { icon: IconType; iconSize?:
"small" | "normal" | "large"; gradient?: boolean }) so the function CardAction
no longer accepts children and intent is explicit.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/components/ui/card.tsx`:
- Around line 44-53: Change the props type for CardTitle to use the correct h3
intrinsic element instead of div: update the signature from
React.ComponentProps<"div"> & { gradient?: boolean } to
React.ComponentProps<"h3"> & { gradient?: boolean } (and if CardTitle
accepts/forwards refs, ensure any forwardRef or ref types are also updated to
HTMLHeadingElement). This fixes the intrinsic prop and ref type mismatch for the
CardTitle component.

---

Nitpick comments:
In `@src/components/ui/card.tsx`:
- Around line 61-90: The CardAction component's props type currently extends
React.ComponentProps<"div"> which includes children and allows callers to pass
children that will be ignored; update the CardAction props to exclude children
by replacing the props type (used in the CardAction signature) with a custom
type that omits "children" (e.g., Omit<React.ComponentProps<"div">, "children">
& { icon: IconType; iconSize?: "small" | "normal" | "large"; gradient?: boolean
}) so the function CardAction no longer accepts children and intent is explicit.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 72d59b7e-5306-41e7-929c-9a866526c02f

📥 Commits

Reviewing files that changed from the base of the PR and between 0661f54 and eff6814.

📒 Files selected for processing (2)
  • src/components/card-caption.tsx
  • src/components/ui/card.tsx
✅ Files skipped from review due to trivial changes (1)
  • src/components/card-caption.tsx

Comment thread src/components/ui/card.tsx Outdated
@toto04
toto04 merged commit adb2527 into main Apr 22, 2026
2 checks passed
@toto04
toto04 deleted the Diubii/card branch April 22, 2026 19:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Card

3 participants