Skip to content

refactor: update the How It Works component to new design#31

Open
FabianSanchezD wants to merge 3 commits intoACTA-Team:developfrom
FabianSanchezD:refactor/how-it-works-component
Open

refactor: update the How It Works component to new design#31
FabianSanchezD wants to merge 3 commits intoACTA-Team:developfrom
FabianSanchezD:refactor/how-it-works-component

Conversation

@FabianSanchezD
Copy link

@FabianSanchezD FabianSanchezD commented Feb 25, 2026

🚀 ACTA Pull Request

Mark with an x all the checkboxes that apply (like [x])


📌 Type of Change

  • Documentation (updates to README, docs, or comments)
  • Bug fix (non-breaking change which fixes an issue)
  • Enhancement (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

📝 Changes description

Updated the How It Works component on the main landing page, using the attached design on the closed issue. Follows all guidelines.


📸 Evidence (A Loom/Cap video is required as evidence, we WON'T merge if there's no proof)

Checkout this video for proof of how the component looks:
https://cap.so/s/tak2k8jxdx223h1

npm run lint (warning in other components, not this one):
image

npm run build (warnings in other components):
image


⏰ Time spent breakdown

1 hour


🌌 Comments

Thanks for reviewing this PR! Let me know if any changes are required.


Thank you for contributing to ACTA! We hope you can continue contributing to this project.

Summary by CodeRabbit

  • New Features

    • Redesigned "How It Works" into an interactive accordion with expandable steps, smooth open/close animations, and a “Powered by Stellar” footer.
    • Improved accessibility for step controls and content (better ARIA/ID handling).
  • Style

    • Removed the "How It Works" heading block from the Use Cases section for a cleaner layout.
    • Updated step presentation with large step numbers, icons, and chevron indicators.

@vercel
Copy link
Contributor

vercel bot commented Feb 25, 2026

@FabianSanchezD is attempting to deploy a commit to the ACTA Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai
Copy link

coderabbitai bot commented Feb 25, 2026

📝 Walkthrough

Walkthrough

Refactored the "How It Works" component from a card-based flip-card layout to a vertically-stacked accordion with controlled single-step expansion, animated open/close, and accessibility IDs. Also removed the "How It Works" heading block from the Use Cases section in the page template.

Changes

Cohort / File(s) Summary
Page Layout
src/app/page.tsx
Removed the motion.h2 "How It Works" heading block from the Use Cases section (6 lines deleted). No other page behavior changed.
How It Works Component Rewrite
src/features/how-it-works/HowItWorks.tsx
Replaced flip-card UI with a data-driven accordion: added stepsData, StepRow, openStep controlled state, useId-based trigger/content IDs for accessibility, AnimatePresence/motion-driven open/close with defined timing/easing, chevron rotation, and removed prior 3D flip/back-front card structure and associated Card/Badge usage. Public API unchanged.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

🐰✨ Cards unturned, three steps align,
Numbers bright where sections shine,
A toggle here, a chevron spin,
Smoothly open — progress begins!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

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.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly aligns with the PR's main change: refactoring the How It Works component to match the new design specification from issue #24.
Linked Issues check ✅ Passed Changes implement all core requirements from #24: vertical accordion layout, single-step expansion, smooth animations, large step numbers, and proper visual hierarchy, with lint passing.
Out of Scope Changes check ✅ Passed The removal of the 'How It Works' heading from page.tsx is a minimal, related adjustment; all other changes directly support the accordion refactor objectives.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

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: 2

🧹 Nitpick comments (1)
src/components/HowItWorks.tsx (1)

10-17: id and number fields on Step are always identical — consider unifying.

Every entry has id: "0x" and number: "0x" with the same value. number is only used for display (Line 104); id drives all logic (keying, accordion state, ARIA ID generation). The duplicate field adds noise to the type and every data object.

♻️ Proposed simplification
 type Step = {
-  id: string;
-  number: string;
+  id: string;        // "01" | "02" | "03" — also rendered as the large number
   icon: React.ReactNode;
   title: string;
   description: string;
   bullets: string[];
 };

 // In stepsData, remove the `number` field:
-  { id: "01", number: "01", icon: ..., ... },
+  { id: "01", icon: ..., ... },

 // In StepRow, render `step.id` instead of `step.number`:
-  {step.number}
+  {step.id}

Also applies to: 19-59

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

In `@src/components/HowItWorks.tsx` around lines 10 - 17, The Step type currently
duplicates id and number; remove the number field from the Step type and from
all step data objects, and update the HowItWorks rendering to use Step.id (or a
derived/format function) for display where step.number was used (the keying,
accordion state, and ARIA IDs should continue to use step.id unchanged). Update
any references to step.number in components (e.g., the step header/label render)
to use step.id or formatStepNumber(step.id) and adjust tests/types accordingly
so only Step.id remains as the unique identifier. Ensure TypeScript types, prop
usages, and any mapping over steps (e.g., in HowItWorks) compile after removing
number.
🤖 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/HowItWorks.tsx`:
- Around line 205-210: The id "how-it-works-label" on the <p> in the HowItWorks
component is unused and should be removed to eliminate dead markup; either
delete the id attribute from that element or, if you intended it to be used for
accessibility, update the container's aria-labelledby to reference
"how-it-works-label" (instead of or in addition to
"how-it-works-heading")—locate the <p> with id="how-it-works-label" and remove
the id or update the section's aria-labelledby accordingly.
- Around line 143-153: The collapse snaps shut because the element uses
hidden={!isExpanded}, which applies display:none immediately and prevents the
gridTemplateRows transition and inner motion.div exit animation; change the
attribute to aria-hidden={!isExpanded} on the region (the div with
role="region", id={contentId}, aria-labelledby={triggerId}) so the visual
collapse (gridTemplateRows and inner overflow:hidden) can animate while still
signaling hidden state to assistive tech; leave the role/id/aria-labelledby and
the gridTemplateRows/isExpanded logic intact.

---

Nitpick comments:
In `@src/components/HowItWorks.tsx`:
- Around line 10-17: The Step type currently duplicates id and number; remove
the number field from the Step type and from all step data objects, and update
the HowItWorks rendering to use Step.id (or a derived/format function) for
display where step.number was used (the keying, accordion state, and ARIA IDs
should continue to use step.id unchanged). Update any references to step.number
in components (e.g., the step header/label render) to use step.id or
formatStepNumber(step.id) and adjust tests/types accordingly so only Step.id
remains as the unique identifier. Ensure TypeScript types, prop usages, and any
mapping over steps (e.g., in HowItWorks) compile after removing number.

ℹ️ Review info

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9ba35ab and 7668145.

📒 Files selected for processing (2)
  • src/app/page.tsx
  • src/components/HowItWorks.tsx
💤 Files with no reviewable changes (1)
  • src/app/page.tsx

Comment on lines 143 to 153
<div
className="col-span-4 grid grid-cols-subgrid transition-[grid-template-rows] duration-300"
style={{
transform: "rotateY(180deg)",
backfaceVisibility: "hidden",
WebkitBackfaceVisibility: "hidden",
gridTemplateRows: isExpanded ? "1fr" : "0fr",
transitionTimingFunction: "cubic-bezier(0.32, 0.72, 0, 1)",
}}
role="region"
id={contentId}
aria-labelledby={triggerId}
hidden={!isExpanded}
>
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

hidden={!isExpanded} breaks the collapse animation — content snaps shut.

The hidden HTML attribute applies display: none immediately on the next render cycle after isExpanded flips to false. Because display: none is synchronous and layout-removing, the CSS grid-template-rows: 1fr → 0fr transition never renders on close, and the AnimatePresence exit opacity animation on the inner motion.div is also invisible (its parent is already hidden). Only the open direction animates; the close direction snaps.

The visual collapse is already handled by gridTemplateRows: "0fr" + overflow: hidden on the inner div (Line 154), so hidden is redundant for layout purposes. To retain screen-reader exclusion without breaking animation, replace hidden with aria-hidden:

🐛 Proposed fix
  <div
    className="col-span-4 grid grid-cols-subgrid transition-[grid-template-rows] duration-300"
    style={{
      gridTemplateRows: isExpanded ? "1fr" : "0fr",
      transitionTimingFunction: "cubic-bezier(0.32, 0.72, 0, 1)",
    }}
    role="region"
    id={contentId}
    aria-labelledby={triggerId}
-   hidden={!isExpanded}
+   aria-hidden={!isExpanded}
  >
📝 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
<div
className="col-span-4 grid grid-cols-subgrid transition-[grid-template-rows] duration-300"
style={{
transform: "rotateY(180deg)",
backfaceVisibility: "hidden",
WebkitBackfaceVisibility: "hidden",
gridTemplateRows: isExpanded ? "1fr" : "0fr",
transitionTimingFunction: "cubic-bezier(0.32, 0.72, 0, 1)",
}}
role="region"
id={contentId}
aria-labelledby={triggerId}
hidden={!isExpanded}
>
<div
className="col-span-4 grid grid-cols-subgrid transition-[grid-template-rows] duration-300"
style={{
gridTemplateRows: isExpanded ? "1fr" : "0fr",
transitionTimingFunction: "cubic-bezier(0.32, 0.72, 0, 1)",
}}
role="region"
id={contentId}
aria-labelledby={triggerId}
aria-hidden={!isExpanded}
>
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/components/HowItWorks.tsx` around lines 143 - 153, The collapse snaps
shut because the element uses hidden={!isExpanded}, which applies display:none
immediately and prevents the gridTemplateRows transition and inner motion.div
exit animation; change the attribute to aria-hidden={!isExpanded} on the region
(the div with role="region", id={contentId}, aria-labelledby={triggerId}) so the
visual collapse (gridTemplateRows and inner overflow:hidden) can animate while
still signaling hidden state to assistive tech; leave the
role/id/aria-labelledby and the gridTemplateRows/isExpanded logic intact.

Comment on lines +205 to +210
<p
id="how-it-works-label"
className="text-xs font-medium uppercase text-white/50 tracking-[0.4em]"
>
HOW IT WORKS
</p>
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

id="how-it-works-label" is defined but never referenced.

No aria-labelledby or aria-describedby points to "how-it-works-label". The section's accessible name already comes from the <h2> via aria-labelledby="how-it-works-heading". The unused id is dead markup.

🧹 Proposed fix
-      <p
-        id="how-it-works-label"
-        className="text-xs font-medium uppercase text-white/50 tracking-[0.4em]"
-      >
+      <p className="text-xs font-medium uppercase text-white/50 tracking-[0.4em]">
📝 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
<p
id="how-it-works-label"
className="text-xs font-medium uppercase text-white/50 tracking-[0.4em]"
>
HOW IT WORKS
</p>
<p className="text-xs font-medium uppercase text-white/50 tracking-[0.4em]">
HOW IT WORKS
</p>
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/components/HowItWorks.tsx` around lines 205 - 210, The id
"how-it-works-label" on the <p> in the HowItWorks component is unused and should
be removed to eliminate dead markup; either delete the id attribute from that
element or, if you intended it to be used for accessibility, update the
container's aria-labelledby to reference "how-it-works-label" (instead of or in
addition to "how-it-works-heading")—locate the <p> with id="how-it-works-label"
and remove the id or update the section's aria-labelledby accordingly.

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.

🧹 Nitpick comments (2)
src/features/how-it-works/HowItWorks.tsx (2)

12-24: Consider consolidating redundant id and number fields.

Both id and number hold identical values ("01", "02", "03"). You could derive one from the other or use a single field to reduce duplication.

♻️ Suggested simplification
 type Step = {
-  id: string;
   number: string;
   icon: React.ReactNode;
   title: string;
   description: string;
   bullets: string[];
 };

 const stepsData: Step[] = [
   {
-    id: "01",
     number: "01",
     // ...
   },
   // ...
 ];

Then use step.number as the key and for state comparison.

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

In `@src/features/how-it-works/HowItWorks.tsx` around lines 12 - 24, The Step type
and stepsData currently duplicate the same value in id and number; remove the
redundant id field from the Step type and each object in stepsData, then update
any usages (e.g., React list key and state comparisons) to use step.number
instead of step.id; search for references to id in this component (and tests)
and replace them with number to ensure keys, lookups and equality checks use the
single number field.

183-183: Consider extracting the repeated hardcoded color.

The color #616161 is used here and again on line 233. For maintainability, consider extracting it to a Tailwind theme extension or CSS variable.

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

In `@src/features/how-it-works/HowItWorks.tsx` at line 183, The hardcoded color
literal "text-[`#616161`]" appears repeatedly in HowItWorks.tsx (e.g., the <p
className="text-sm text-[`#616161`] sm:text-base leading-relaxed"> instance);
extract this color into a reusable token by adding it to your Tailwind theme (or
define a CSS variable) with a semantic name (e.g., "muted" or "text-muted") and
then replace all occurrences of "text-[`#616161`]" in HowItWorks.tsx with the new
utility (e.g., "text-muted"); update any other instances in the file (the second
occurrence noted in the review) to use the new token so the color is maintained
centrally.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@src/features/how-it-works/HowItWorks.tsx`:
- Around line 12-24: The Step type and stepsData currently duplicate the same
value in id and number; remove the redundant id field from the Step type and
each object in stepsData, then update any usages (e.g., React list key and state
comparisons) to use step.number instead of step.id; search for references to id
in this component (and tests) and replace them with number to ensure keys,
lookups and equality checks use the single number field.
- Line 183: The hardcoded color literal "text-[`#616161`]" appears repeatedly in
HowItWorks.tsx (e.g., the <p className="text-sm text-[`#616161`] sm:text-base
leading-relaxed"> instance); extract this color into a reusable token by adding
it to your Tailwind theme (or define a CSS variable) with a semantic name (e.g.,
"muted" or "text-muted") and then replace all occurrences of "text-[`#616161`]" in
HowItWorks.tsx with the new utility (e.g., "text-muted"); update any other
instances in the file (the second occurrence noted in the review) to use the new
token so the color is maintained centrally.

ℹ️ Review info

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 318bd18 and d653ef7.

📒 Files selected for processing (1)
  • src/features/how-it-works/HowItWorks.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.

🎨 Visual Refactor - "How It Works" Component

1 participant