Skip to content

Add CommunityNews component#78

Open
BIA3IA wants to merge 15 commits into
mainfrom
bianca/communityNews
Open

Add CommunityNews component#78
BIA3IA wants to merge 15 commits into
mainfrom
bianca/communityNews

Conversation

@BIA3IA
Copy link
Copy Markdown
Contributor

@BIA3IA BIA3IA commented Apr 14, 2026

Introduce the CommunityNews component to display community updates

Closes #74

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 14, 2026

Review Change Stack

Walkthrough

This PR adds carousel UI infrastructure and integrates two new carousel-based features: a home page carousel mock and a projects community news section. It includes carousel component foundation with Embla integration, gradient icon sizing support, removes duplicate gradient SVG rendering from cards, and updates both the home and projects pages.

Changes

Carousel UI and Community Features

Layer / File(s) Summary
Carousel UI Foundation
src/components/ui/carousel.tsx
Carousel component built on embla-carousel-react with types, context, and useCarousel() hook; exports CarouselContent (scrollable container), CarouselItem (accessible slide fieldset), and CarouselDots (navigation indicators with aria-current support) that consume shared carousel state.
Gradient Icon Enhancement
src/components/gradient-icon.tsx
GradientIconType extends to accept optional size?: string prop; Icon now renders with explicit size="16" while maintaining stroke="white" and fill="none".
Card Gradient Rendering Fix
src/components/ui/card.tsx
CardAction removes the conditional hidden SVG linearGradient definition that was previously rendered before the icon element.
Home Page Carousel Mock
src/components/home/carousel-mock.tsx
New CarouselMock component with mockCards constant data; renders PoliNetwork heading and carousel of CardCaption items with CarouselDots navigation (marked for deletion once real data is available).
Projects Community News Component
src/components/projects/community-news.tsx
New CommunityNews component with communityCards data; renders desktop grid (2–4 columns) of CardCaption items and mobile carousel using Carousel/CarouselContent/CarouselItem/CarouselDots with responsive layout switching.
Page Integration
src/app/page.tsx, src/app/projects/page.tsx
Home page imports and renders CarouselMock before AboutUs, replaces CardMultipleIcons with CardSplit (donation text), and updates container to flex column layout; new projects page renders CommunityNews inside full-width main element.

Possibly related PRs

🚥 Pre-merge checks | ✅ 2 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 10.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Out of Scope Changes check ❓ Inconclusive Changes to .gitignore, gradient-icon, and card.tsx appear tangentially related but support the CommunityNews feature. However, .gitignore and card.tsx changes may extend beyond the core requirement. Clarify whether .gitignore updates and CardAction SVG removal are necessary for issue #74 or represent separate improvements that should be in different PRs.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the primary change: adding the CommunityNews component. It is concise, clear, and directly reflects the main file additions and changes throughout the PR.
Linked Issues check ✅ Passed The PR implements the CommunityNews component with responsive grid/carousel layouts as required by issue #74, including proper styling and UI structure. The implementation is complete and functional.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

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.

@BIA3IA BIA3IA self-assigned this Apr 15, 2026
@BIA3IA BIA3IA marked this pull request as ready for review May 12, 2026 10:42
Copy link
Copy Markdown
Contributor

@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: 3

🧹 Nitpick comments (2)
src/components/ui/carousel.tsx (2)

133-133: ⚡ Quick win

Add aria-label to improve carousel accessibility.

The carousel section should have a descriptive label so screen reader users understand the purpose of the region.

♿ Proposed fix
-      <section onKeyDownCapture={handleKeyDown} className={cn("relative", className)} data-slot="carousel" {...props}>
+      <section onKeyDownCapture={handleKeyDown} aria-label="Carousel" className={cn("relative", className)} data-slot="carousel" {...props}>

Or allow consumers to override it via props:

-}: React.ComponentProps<"div"> & CarouselProps) {
+}: React.ComponentProps<"div"> & CarouselProps & { "aria-label"?: string }) {
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/components/ui/carousel.tsx` at line 133, The carousel's root <section>
currently lacks an accessible name—add an aria-label (e.g.,
aria-label="Carousel" or a more descriptive string) to the section element
rendered in the Carousel component and allow consumers to override it via props
(accept e.g., ariaLabel or passthrough aria-* props), so update the component
props usage to prefer the provided ariaLabel/props value and fallback to a
sensible default; make changes in the render line that uses handleKeyDown, cn,
className and {...props} so the aria attribute is included and can be
overridden.

177-179: ⚡ Quick win

Add visible focus indicator to dot buttons.

The button uses outline-none but doesn't provide an alternative focus indicator. This creates an accessibility barrier for keyboard users who cannot see which dot has focus.

♿ Proposed fix
           className={cn(
-            "flex size-5 appearance-none items-center justify-center rounded-full bg-transparent p-0 outline-none transition-colors"
+            "flex size-5 appearance-none items-center justify-center rounded-full bg-transparent p-0 outline-none transition-colors focus-visible:ring-2 focus-visible:ring-white/50"
           )}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/components/ui/carousel.tsx` around lines 177 - 179, The dot button
currently removes the browser focus indicator via the "outline-none" class in
the className passed to cn; replace that with an accessible focus style instead
of removing it so keyboard users can see focus. Locate the element rendering the
dot buttons (the className string containing "outline-none" in
src/components/ui/carousel.tsx) and remove or narrow the use of "outline-none",
adding a visible focus-visible style such as a ring/outline on focus (e.g., use
focus-visible:ring, focus-visible:ring-offset, or focus-visible:outline classes
with an appropriate color and offset) so the button keeps a clear visual
indicator when focused while preserving hover/active styles.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/components/projects/community-news.tsx`:
- Around line 5-34: The communityCards constant contains placeholder data
(titles "Title 1"..."Title 4", lorem ipsum captions, and repeated FiCrop icons)
that must be replaced before production; update the communityCards array in
src/components/projects/community-news.tsx by replacing each object’s title,
caption, and icon fields with real community news content and appropriate icon
components (or dynamic props) and ensure iconPosition stays correct; keep the
array shape (the objects and the as const typing) so existing rendering logic
that references communityCards continues to work.

In `@src/components/ui/carousel.tsx`:
- Around line 150-161: The CarouselItem component is using a <fieldset> which is
semantically incorrect for non-form carousel slides; replace the fieldset with a
<div> in the CarouselItem function to correct semantics: update the JSX returned
by CarouselItem (which uses useCarousel() and sets aria-roledescription="slide"
and data-slot="carousel-item") so it renders a div with the same props,
className, aria attributes and data-slot, preserving behavior and accessibility
attributes.
- Around line 170-189: Replace the fragile key usage for carousel indicators: in
the map over scrollSnaps inside the render (the Button elements created from
scrollSnaps.map) use the stable index as the React key instead of the scrollSnap
value; update the Button's key from scrollSnap to index (the rest of the props
such as aria-label, aria-current using selectedIndex, onClick calling
api?.scrollTo(index), and the inner span logic can remain unchanged).

---

Nitpick comments:
In `@src/components/ui/carousel.tsx`:
- Line 133: The carousel's root <section> currently lacks an accessible name—add
an aria-label (e.g., aria-label="Carousel" or a more descriptive string) to the
section element rendered in the Carousel component and allow consumers to
override it via props (accept e.g., ariaLabel or passthrough aria-* props), so
update the component props usage to prefer the provided ariaLabel/props value
and fallback to a sensible default; make changes in the render line that uses
handleKeyDown, cn, className and {...props} so the aria attribute is included
and can be overridden.
- Around line 177-179: The dot button currently removes the browser focus
indicator via the "outline-none" class in the className passed to cn; replace
that with an accessible focus style instead of removing it so keyboard users can
see focus. Locate the element rendering the dot buttons (the className string
containing "outline-none" in src/components/ui/carousel.tsx) and remove or
narrow the use of "outline-none", adding a visible focus-visible style such as a
ring/outline on focus (e.g., use focus-visible:ring, focus-visible:ring-offset,
or focus-visible:outline classes with an appropriate color and offset) so the
button keeps a clear visual indicator when focused while preserving hover/active
styles.
🪄 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: ab530db8-60d2-456d-87d8-13c433b33b3b

📥 Commits

Reviewing files that changed from the base of the PR and between f34cf16 and b705fe2.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (9)
  • .gitignore
  • package.json
  • src/app/page.tsx
  • src/app/projects/page.tsx
  • src/components/gradient-icon.tsx
  • src/components/home/carousel-mock.tsx
  • src/components/projects/community-news.tsx
  • src/components/ui/card.tsx
  • src/components/ui/carousel.tsx
💤 Files with no reviewable changes (1)
  • src/components/ui/card.tsx

Comment thread src/components/projects/community-news.tsx
Comment thread src/components/ui/carousel.tsx
Comment thread src/components/ui/carousel.tsx
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.

Projects - Comunity News

1 participant