From 2c9792f09017dc26209901e951275c767197216b Mon Sep 17 00:00:00 2001 From: Fabio Gaming Date: Tue, 26 May 2026 22:40:37 +0200 Subject: [PATCH 1/6] docs: add documentation comments for For component - Added JSDoc comments to the For component for better clarity. - Included an example usage in the documentation. --- src/components/For.tsx | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/components/For.tsx b/src/components/For.tsx index 9c8ff9c..21a595d 100644 --- a/src/components/For.tsx +++ b/src/components/For.tsx @@ -5,6 +5,20 @@ export type ForProps = { children: (item: T, index: number) => React.ReactNode; }; +/** + * Renders a list by mapping each item to JSX with a render function. + * + * @example + * ```tsx + * + * {(user, index) => ( + *
  • + * {index + 1}. {user.name} + *
  • + * )} + *
    + * ``` + */ export function For(props: ForProps) { return <>{props.each.map((item, i) => props.children(item, i))}; } From 568e2c04a3b22e6259849306dd56fb7ee4f4706b Mon Sep 17 00:00:00 2001 From: Fabio Gaming Date: Tue, 26 May 2026 22:40:50 +0200 Subject: [PATCH 2/6] docs: add documentation comments for Match component - Added detailed documentation comments for the Match component. - Included usage examples and remarks for better understanding. --- src/components/Match.tsx | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/components/Match.tsx b/src/components/Match.tsx index 01d886e..6261dee 100644 --- a/src/components/Match.tsx +++ b/src/components/Match.tsx @@ -5,6 +5,20 @@ export type MatchProps = { children: React.ReactNode; }; +/** + * Renders children only when `when` is truthy. + * + * @remarks + * `Match` should only be used inside [Switch](./Switch.tsx). + * For standalone conditional rendering, use [Show](./Show.tsx). + * + * @example + * ```tsx + * + *

    Admin panel

    + *
    + * ``` + */ export function Match(props: MatchProps) { return <>{props.when ? props.children : null}; } From d7297e30337628fe955bf0aede7cfba805475e4b Mon Sep 17 00:00:00 2001 From: Fabio Gaming Date: Tue, 26 May 2026 22:41:02 +0200 Subject: [PATCH 3/6] docs: add documentation comments for Show component - Added detailed documentation comments for the Show component. - Included an example usage in the comments for clarity. --- src/components/Show.tsx | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/components/Show.tsx b/src/components/Show.tsx index 106a0c2..4d83724 100644 --- a/src/components/Show.tsx +++ b/src/components/Show.tsx @@ -6,6 +6,16 @@ export type ShowProps = { children: React.ReactNode; }; +/** + * Conditionally renders children when `when` is truthy, otherwise renders `fallback`. + * + * @example + * ```tsx + * Loading...

    }> + *

    Welcome back!

    + *
    + * ``` + */ export function Show(props: ShowProps) { return props.when ? <>{props.children} : <>{props.fallback}; } From 231a5267313c37c1ae8d39e6292f2c6f98a2ab4f Mon Sep 17 00:00:00 2001 From: Fabio Gaming Date: Tue, 26 May 2026 22:41:08 +0200 Subject: [PATCH 4/6] docs: add documentation comments for Switch component - Added JSDoc comments to describe the functionality of the Switch component. - Included an example usage of the Switch component with Match children. --- src/components/Switch.tsx | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/components/Switch.tsx b/src/components/Switch.tsx index 4119c77..b54326f 100644 --- a/src/components/Switch.tsx +++ b/src/components/Switch.tsx @@ -1,6 +1,18 @@ import React from "react"; import { Match, MatchProps } from "./Match"; +/** + * Renders the children of the first `Match` child whose `when` prop is truthy. + * + * @example + * ```tsx + * + * Loading... + * Done! + * Something went wrong. + * + * ``` + */ export function Switch(props: { children: React.ReactNode }) { const children = React.Children.toArray(props.children); From c5b0bd28019d48af3b7467bf12f39a6b3362ed8f Mon Sep 17 00:00:00 2001 From: Fabio Gaming Date: Tue, 26 May 2026 22:46:13 +0200 Subject: [PATCH 5/6] docs: update documentation comments for Match component - Removed links from remarks for clarity --- src/components/Match.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/Match.tsx b/src/components/Match.tsx index 6261dee..49d7689 100644 --- a/src/components/Match.tsx +++ b/src/components/Match.tsx @@ -9,8 +9,8 @@ export type MatchProps = { * Renders children only when `when` is truthy. * * @remarks - * `Match` should only be used inside [Switch](./Switch.tsx). - * For standalone conditional rendering, use [Show](./Show.tsx). + * `Match` should only be used inside `Switch`. + * For standalone conditional rendering, use `Show`. * * @example * ```tsx From f4129310490db49cbeb2a28ae062057b38e0df39 Mon Sep 17 00:00:00 2001 From: Fabio Gaming Date: Tue, 26 May 2026 22:49:40 +0200 Subject: [PATCH 6/6] Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- src/components/Match.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/Match.tsx b/src/components/Match.tsx index 49d7689..ba8a7a9 100644 --- a/src/components/Match.tsx +++ b/src/components/Match.tsx @@ -9,8 +9,8 @@ export type MatchProps = { * Renders children only when `when` is truthy. * * @remarks - * `Match` should only be used inside `Switch`. - * For standalone conditional rendering, use `Show`. + * `Match` is typically used inside `Switch`. + * For standalone conditional rendering, consider `Show`. * * @example * ```tsx