Skip to content

Conversation

@Diubii
Copy link

@Diubii Diubii commented Dec 17, 2025

Closes #12

@coderabbitai
Copy link

coderabbitai bot commented Dec 17, 2025

Walkthrough

Dependency versions updated to include new Radix UI components and newer React releases. Two new UI components introduced: Button with multiple variants and ButtonWithIcon combining icons with button text. Main page refactored to display welcome content with the new icon-enabled buttons.

Changes

Cohort / File(s) Change Summary
Dependency Updates
package.json
Updated React, React DOM, and form-related dependencies to newer versions; added @radix-ui/react-separator and @radix-ui/react-slot; incremented @tailwindcss/postcss and type declarations for Node, React, and React DOM.
UI Component Library
src/components/ui/button.tsx, src/components/ui/buttonWithIcon.tsx
Introduced Button component with configurable variants (primary, tertiary, tertiaryBlur, outline, link) and sizes (default, sm, lg, icon variants); created ButtonWithIcon wrapper component accepting icon, text, and icon position props.
Page Content
src/app/page.tsx
Added page heading "Welcome to PoliNetwork" and introductory paragraph; replaced single button with three ButtonWithIcon components using Users icon with text "Diventa socio" and a link button variant.

Pre-merge checks and finishing touches

❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
Title check ❓ Inconclusive The title 'Button' is too vague and generic; it does not convey meaningful information about what the changeset accomplishes. Use a more descriptive title that clarifies the primary change, such as 'Add Button component with variants and ButtonWithIcon wrapper' or 'Introduce reusable Button UI component with icon support'.
✨ Finishing touches
  • 📝 Generate docstrings

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 self-assigned this Dec 17, 2025
@Diubii
Copy link
Author

Diubii commented Dec 17, 2025

Devo aggiungere anche href / action?

@Diubii Diubii marked this pull request as ready for review December 17, 2025 22:54
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 4

🧹 Nitpick comments (4)
src/components/ui/buttonWithIcon.tsx (3)

16-16: Consider making the button size configurable.

The size is hardcoded to "lg". Consider accepting a size prop to allow different button sizes when needed.

 export function ButtonWithIcon({
   variant = "primary",
   icon: Icon,
   text,
   iconPosition = "left",
+  size = "lg",
   ...props
 }: {
   variant?: "primary" | "tertiary" | "tertiaryBlur"
   icon: LucideIcon
   text: string
   iconPosition?: "left" | "right"
+  size?: "default" | "sm" | "lg"
 } & Omit<ComponentPropsWithoutRef<"button"> & { asChild?: boolean }, "children">) {
   return (
-    <Button variant={variant} size="lg" {...props}>
+    <Button variant={variant} size={size} {...props}>
       {iconPosition === "left" && <Icon />}
       {text}
       {iconPosition === "right" && <Icon />}
     </Button>
   )
 }

10-10: Consider supporting all Button variants.

The variant type only includes "primary" | "tertiary" | "tertiaryBlur", excluding "outline" and "link" variants that are supported by the underlying Button component. Unless there's a specific reason to restrict these, consider allowing all variants.

+import type { VariantProps } from "class-variance-authority"
+import { buttonVariants } from "./button"

 export function ButtonWithIcon({
   variant = "primary",
   icon: Icon,
   text,
   iconPosition = "left",
 }: {
-  variant?: "primary" | "tertiary" | "tertiaryBlur"
+  variant?: VariantProps<typeof buttonVariants>["variant"]
   icon: LucideIcon
   text: string
   iconPosition?: "left" | "right"
 }) {

1-1: Add screen reader context for the icon.

Consider whether the icon is decorative or conveys meaning. If it's decorative (since the text is already present), add aria-hidden="true" to the icon. If it conveys additional meaning, ensure proper labeling.

 return (
   <Button variant={variant} size="lg">
-    {iconPosition === "left" && <Icon />}
+    {iconPosition === "left" && <Icon aria-hidden="true" />}
     {text}
-    {iconPosition === "right" && <Icon />}
+    {iconPosition === "right" && <Icon aria-hidden="true" />}
   </Button>
 )
src/components/ui/button.tsx (1)

9-9: Consider extracting base button styles for readability.

The base className string is very long (focus-visible, aria-invalid states, etc.). While functional, extracting these into named constants or separate CVA layers could improve maintainability.

Example:

const baseButtonStyles = "inline-flex items-center justify-center gap-2 whitespace-nowrap text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50"
const svgStyles = "[&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0"
const focusStyles = "outline-none focus-visible:border-slate-950 focus-visible:ring-slate-950/50 focus-visible:ring-[3px] dark:focus-visible:border-slate-300 dark:focus-visible:ring-slate-300/50"
const ariaInvalidStyles = "aria-invalid:ring-red-500/20 dark:aria-invalid:ring-red-500/40 aria-invalid:border-red-500 dark:aria-invalid:ring-red-900/20 dark:dark:aria-invalid:ring-red-900/40 dark:aria-invalid:border-red-900"

const buttonVariants = cva(
  [baseButtonStyles, svgStyles, focusStyles, ariaInvalidStyles].join(" "),
  {
    variants: {
      // ...
    }
  }
)
📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 230916f and 723d0b4.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (4)
  • package.json (2 hunks)
  • src/app/page.tsx (2 hunks)
  • src/components/ui/button.tsx (1 hunks)
  • src/components/ui/buttonWithIcon.tsx (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (3)
src/components/ui/buttonWithIcon.tsx (1)
src/components/ui/button.tsx (1)
  • Button (62-62)
src/components/ui/button.tsx (1)
src/lib/utils.ts (1)
  • cn (12-14)
src/app/page.tsx (2)
src/components/ui/buttonWithIcon.tsx (1)
  • ButtonWithIcon (4-22)
src/components/ui/button.tsx (1)
  • Button (62-62)
🔇 Additional comments (5)
src/app/page.tsx (1)

8-11: LGTM! Clear welcome content.

The heading and introductory paragraph provide good context for the page.

src/components/ui/button.tsx (3)

7-7: Clarify the TODO comment about variants.

The TODO comment suggests the variants might need work. Are you planning to add more variants, or does this need design review?


39-60: Excellent Button implementation with asChild pattern.

The component correctly uses Radix Slot for composition, applies proper data attributes for testing/styling, and supports comprehensive variants and sizes. The use of ComponentProps<"button"> ensures all native button props are supported.


13-21: All custom Tailwind classes in the button variants are properly defined and integrated into the design system. The bg-button-primary, text-text-accent-lightbg, rounded-buttonsM, and bg-blue-tertiary-blur classes are defined in src/styles/figma.css via @theme directives, mapping to Figma design variables. The typo-label-large utility is defined in src/styles/typography.css. No action needed.

package.json (1)

16-17: Dependency versions are secure and compatible.

All specified versions are patched for known vulnerabilities: React 19.2.3 includes fixes for critical React Server Component vulnerabilities, Zod 4.2.1 has no known security issues, and Radix UI packages are current and support React 19. No action required.

},
"dependencies": {
"@t3-oss/env-nextjs": "^0.13.8",
"@radix-ui/react-separator": "^1.1.8",
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Check if react-separator is imported or used anywhere in the codebase
rg -n "@radix-ui/react-separator" --type=ts --type=tsx -g '!package.json'

Repository: PoliNetworkOrg/web

Length of output: 89


🏁 Script executed:

#!/bin/bash
# Check if react-separator is imported or used anywhere in the codebase
rg -n "@radix-ui/react-separator" -g '!package.json'

Repository: PoliNetworkOrg/web

Length of output: 340


🏁 Script executed:

#!/bin/bash
# Search for any import/usage of react-separator in source files only
rg "react-separator|Separator" --type=js --type=jsx -g '!node_modules' -g '!pnpm-lock.yaml' -g '!package-lock.json' -c

Repository: PoliNetworkOrg/web

Length of output: 89


🏁 Script executed:

#!/bin/bash
# Comprehensive search for react-separator usage excluding lock files and node_modules
rg "react-separator|from.*Separator|import.*Separator" --glob='!pnpm-lock.yaml' --glob='!package-lock.json' --glob='!node_modules'

Repository: PoliNetworkOrg/web

Length of output: 117


Remove unused @radix-ui/react-separator dependency from package.json.

The @radix-ui/react-separator dependency is declared but not imported or used in any source files in the codebase.

🤖 Prompt for AI Agents
In package.json around line 16, the dependency "@radix-ui/react-separator":
"^1.1.8" is declared but unused; remove this entry from package.json and then
run package manager cleanup (npm install / npm prune or yarn install) to update
lockfile and node_modules accordingly; also run the test/build or a quick
repo-wide search to confirm nothing imports it before committing.

Comment on lines +15 to +18
<ButtonWithIcon variant="primary" icon={Users} iconPosition="left" text="Diventa socio" />
<ButtonWithIcon variant="tertiary" icon={Users} iconPosition="right" text="Diventa socio" />
<ButtonWithIcon variant="tertiaryBlur" icon={Users} iconPosition="left" text="Diventa socio" />
<Button variant="link">Link</Button>
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Buttons lack functionality - add onClick handlers or href links.

All four buttons have no interactive behavior (no onClick, href, or navigation). This directly relates to your question about adding href/action support. For a functional page, these buttons need actions.

Example implementations:

// For action buttons, add onClick handlers:
<ButtonWithIcon 
  variant="primary" 
  icon={Users} 
  iconPosition="left" 
  text="Diventa socio"
  onClick={() => {/* handle membership signup */}}
/>

// For navigation, use asChild with Next.js Link:
<ButtonWithIcon 
  variant="tertiary" 
  icon={Users} 
  iconPosition="right" 
  text="Diventa socio"
  asChild
>
  <Link href="/membership" />
</ButtonWithIcon>

Note: This requires implementing the prop forwarding suggested in the buttonWithIcon.tsx review first.

🤖 Prompt for AI Agents
In src/app/page.tsx around lines 15 to 18, the four Button/ButtonWithIcon
instances lack any interactive behavior; add either onClick handlers for actions
or enable navigation via href/Next.js Link (using asChild) so the buttons
perform membership signup or navigate to the membership page. First ensure
ButtonWithIcon/buttonWithIcon.tsx forwards native button/link props (onClick,
href, asChild, etc.) and supports rendering a child Link when asChild is true;
then update these usages to pass an onClick for inline actions or wrap/pass a
Link href for navigation so each button is functional.

<ButtonWithIcon variant="primary" icon={Users} iconPosition="left" text="Diventa socio" />
<ButtonWithIcon variant="tertiary" icon={Users} iconPosition="right" text="Diventa socio" />
<ButtonWithIcon variant="tertiaryBlur" icon={Users} iconPosition="left" text="Diventa socio" />
<Button variant="link">Link</Button>
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion | 🟠 Major

Use Next.js Link component for the link button.

The button with variant="link" should use the asChild prop with Next.js Link to enable client-side navigation.

+import Link from "next/link"

 <Button variant="link">Link</Button>
+<Button variant="link" asChild>
+  <Link href="/about">Link</Link>
+</Button>

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
In src/app/page.tsx around line 18, the Button currently rendered as a plain
button with variant="link" should use Next.js client-side navigation; update the
code to import Link from 'next/link' and render the Button with the asChild
prop, wrapping a Next.js Link element that receives the href (e.g. <Link
href="/target">) so the Button delegates to Link for navigation while retaining
variant="link". Ensure the Link is the direct child of Button and remove any
duplicate href on both elements.

Comment on lines +4 to +22
export function ButtonWithIcon({
variant = "primary",
icon: Icon,
text,
iconPosition = "left",
}: {
variant?: "primary" | "tertiary" | "tertiaryBlur"
icon: LucideIcon
text: string
iconPosition?: "left" | "right"
}) {
return (
<Button variant={variant} size="lg">
{iconPosition === "left" && <Icon />}
{text}
{iconPosition === "right" && <Icon />}
</Button>
)
}
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Add support for interactive props (onClick, href, etc.) to make buttons functional.

Regarding your question "Devo aggiungere anche href / action?" — Yes, the component currently cannot handle any interactions. It needs to forward common button props like onClick, support the asChild pattern for links, and accept other HTML button attributes.

Apply this diff to add essential prop forwarding:

+import type { ComponentPropsWithoutRef } from "react"
 import type { LucideIcon } from "lucide-react"
-import { Button } from "./button"
+import { Button, buttonVariants } from "./button"
+import type { VariantProps } from "class-variance-authority"

 export function ButtonWithIcon({
   variant = "primary",
   icon: Icon,
   text,
   iconPosition = "left",
+  ...props
 }: {
   variant?: "primary" | "tertiary" | "tertiaryBlur"
   icon: LucideIcon
   text: string
   iconPosition?: "left" | "right"
-}) {
+} & Omit<ComponentPropsWithoutRef<"button"> & { asChild?: boolean }, "children">) {
   return (
-    <Button variant={variant} size="lg">
+    <Button variant={variant} size="lg" {...props}>
       {iconPosition === "left" && <Icon />}
       {text}
       {iconPosition === "right" && <Icon />}
     </Button>
   )
 }

This allows usage like:

<ButtonWithIcon icon={Users} text="Click me" onClick={handleClick} />
<ButtonWithIcon icon={Users} text="Go to page" asChild>
  <Link href="/page" />
</ButtonWithIcon>
🤖 Prompt for AI Agents
In src/components/ui/buttonWithIcon.tsx around lines 4 to 22, the ButtonWithIcon
component doesn't accept or forward interactive/HTML button props (onClick,
href, asChild, etc.), so update its props to extend the underlying Button's
props (e.g., ButtonProps or React.ButtonHTMLAttributes<HTMLButtonElement> and
support an optional asChild flag and children), allow passing through rest
props, render children when provided (for asChild usage), and spread the
remaining props onto the rendered Button element so consumers can pass onClick,
href via asChild, disabled, aria-attributes, and other common attributes.

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.

Button

2 participants