Skip to content

refactor(reviews): refactor ReviewForm for more flexible rendering#2753

Merged
matthewvolk merged 1 commit intocanaryfrom
CATALYST-1634-refactor-review-form
Dec 9, 2025
Merged

refactor(reviews): refactor ReviewForm for more flexible rendering#2753
matthewvolk merged 1 commit intocanaryfrom
CATALYST-1634-refactor-review-form

Conversation

@matthewvolk
Copy link
Contributor

What/Why?

Refactors ReviewForm to accept a trigger prop (React.ReactNode) instead of formButtonLabel (string). This allows any React node as the trigger, not just a button with a label.

Changes:

  • Removed formButtonLabel prop from ReviewForm
  • Added required trigger prop (React.ReactNode)
  • Moved button rendering to parent components (Reviews and ReviewsEmptyState), which create the Button and pass it as trigger

Improves flexibility and separation of concerns by letting parents control trigger rendering.

Testing

  • Verified review form modal opens when clicking the trigger button
  • Confirmed form submission works correctly
  • Tested both empty state and non-empty state review sections
  • Validated button styling and positioning remain consistent

Migration

Breaking change: ReviewForm no longer accepts formButtonLabel. Update usages:

Before:

<ReviewForm
  formButtonLabel="Write a review"
  // ... other props
/>

After:

<ReviewForm
  trigger={
    <Button className="mx-auto mt-8" size="small" variant="tertiary">
      Write a review
    </Button>
  }
  // ... other props
/>

The trigger prop accepts any React node, allowing custom trigger components.

Note: This pull request description was generated with the assistance of AI.

@matthewvolk matthewvolk requested a review from a team as a code owner December 8, 2025 20:24
@changeset-bot
Copy link

changeset-bot bot commented Dec 8, 2025

🦋 Changeset detected

Latest commit: ee48dfc

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@bigcommerce/catalyst-core Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel
Copy link

vercel bot commented Dec 8, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
catalyst-b2b Ready Ready Preview Comment Dec 8, 2025 8:25pm
catalyst-canary Ready Ready Preview Comment Dec 8, 2025 8:25pm
2 Skipped Deployments
Project Deployment Preview Comments Updated (UTC)
catalyst Ignored Ignored Dec 8, 2025 8:25pm
catalyst-uplift-vertex Ignored Ignored Dec 8, 2025 8:25pm

@matthewvolk matthewvolk added this pull request to the merge queue Dec 9, 2025
Merged via the queue into canary with commit 7927d26 Dec 9, 2025
14 checks passed
@matthewvolk matthewvolk deleted the CATALYST-1634-refactor-review-form branch December 9, 2025 15:40
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.

3 participants