Skip to content

fix(searchInput): Add a propertie in the cms for searchProductsTitle …#3240

Open
evander-corebiz wants to merge 7 commits intovtex:devfrom
evander-corebiz:fix/search-products-title
Open

fix(searchInput): Add a propertie in the cms for searchProductsTitle …#3240
evander-corebiz wants to merge 7 commits intovtex:devfrom
evander-corebiz:fix/search-products-title

Conversation

@evander-corebiz
Copy link
Copy Markdown

@evander-corebiz evander-corebiz commented Mar 16, 2026

…to be able to change on translate this text in the search input results

What's the purpose of this pull request?

This PR introduces a new property to the CMS (Content Management System) for the SearchInput component. The goal is to allow store administrators to customize or translate the title displayed above the suggested products in the search results dropdown, which was previously hardcoded.

How it works?

A new property, searchProductsTitle, has been added to the CMS schema for the searchProducts section. This value is passed down to the UI components, allowing the "Suggested Products" text to be overridden directly through the VTEX Admin interface without requiring code changes for localization.

image image image

How to test it?

In your terminal, inside a store project using this branch, run:

Bash
yarn cms-sync
Access the Store's CMS (VTEX Admin).

Navigate to the Navbar or Search Input settings.

Locate the new searchProductsTitle field.

Enter a custom string (e.g., "Recommended for You" or "Produtos Sugeridos").

Save/Publish the changes and verify that the search dropdown reflects the new title.

Starters Deploy Preview

FastStore Documentation - CMS Integration

References

Checklist

You may erase this after checking them all 😉

PR Title and Commit Messages

  • PR title and commit messages follow the Conventional Commits specification
    • Available prefixes: feat, fix, chore, docs, style, refactor, ci and test

PR Description

  • Added a label according to the PR goal - breaking change, bug, contributing, performance, documentation..

Dependencies

  • Committed the pnpm-lock.yaml file when there were changes to the packages

Documentation

  • PR description
  • For documentation changes, ping @Mariana-Caetano to review and update (Or submit a doc request)

Summary by CodeRabbit

  • New Features
    • Search input dropdown exposes configurable section titles for results: History (default "History"), Top searches (default "Top search"), and Suggested products (default "Suggested products"). These title fields are configurable in the Navbar search settings and will appear consistently across desktop and mobile search dropdowns.

…to be able to change on translate this text in the search input results
@evander-corebiz evander-corebiz requested a review from a team as a code owner March 16, 2026 17:47
@evander-corebiz evander-corebiz requested review from emersonlaurentino and lemagnetic and removed request for a team March 16, 2026 17:47
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Mar 16, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Walkthrough

Adds three configurable title props — searchHistoryTitle, searchTopTitle, and searchProductsTitle — and threads them through the CMS schema, Navbar config, SearchInput, SearchDropdown, and the Search subcomponents.

Changes

Cohort / File(s) Summary
CMS Schema
packages/core/cms/faststore/sections.json, packages/core/cms/faststore/components/cms_component__navbar.jsonc
Added searchHistoryTitle, searchTopTitle, and searchProductsTitle under Navbar → searchInput with default strings and schema metadata.
Navbar config & forwarding
packages/core/src/components/sections/Navbar/Navbar.tsx, packages/core/src/components/navigation/Navbar/Navbar.tsx
Expanded NavbarProps.searchInput to include the three optional title fields and forwarded them into SearchInput in desktop and mobile render paths.
Search input & dropdown
packages/core/src/components/search/SearchInput/SearchInput.tsx, packages/core/src/components/search/SearchDropdown/SearchDropdown.tsx
Extended prop interfaces to accept the three title props; SearchInput forwards them to SearchDropdown, which forwards them to its children.
Search subcomponents
packages/core/src/components/search/SearchHistory/SearchHistory.tsx, packages/core/src/components/search/SearchTop/SearchTop.tsx, packages/core/src/components/search/SearchProducts/...
Made SearchHistory and SearchTop accept title props with defaults and pass them to their UI components; SearchProducts receives title from parent.
Public API surface
packages/core/src/components/search/...
Added optional string props to exported prop types and component signatures for the three titles (minor public API expansion).

Sequence Diagram(s)

sequenceDiagram
  participant Navbar as "Navbar"
  participant SearchInput as "SearchInput"
  participant SearchDropdown as "SearchDropdown"
  participant SearchHistory as "SearchHistory"
  participant SearchTop as "SearchTop"
  participant SearchProducts as "SearchProducts"

  Navbar->>SearchInput: render(props include searchHistoryTitle, searchTopTitle, searchProductsTitle)
  SearchInput->>SearchDropdown: open(dropdownProps with titles)
  SearchDropdown->>SearchHistory: render(title=searchHistoryTitle)
  SearchDropdown->>SearchTop: render(title=searchTopTitle)
  SearchDropdown->>SearchProducts: render(title=searchProductsTitle)
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested labels

enhancement

Suggested reviewers

  • lemagnetic

Poem

🔎 Three titles threaded through the flow,
From schema down where searches go,
History, Top, and Products aligned,
Props pass clean — intent defined,
Small tweak, clearer UI glow. ✨

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Title check ⚠️ Warning The title mentions adding a CMS property for searchProductsTitle, but the PR actually adds three related properties (searchHistoryTitle, searchTopTitle, and searchProductsTitle) across multiple files. Update the title to reflect all three properties being added, e.g., 'fix(searchInput): Add CMS properties for search dropdown section titles' or similar.
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 (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@codesandbox-ci
Copy link
Copy Markdown

codesandbox-ci Bot commented Mar 16, 2026

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

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.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
packages/core/src/components/navigation/Navbar/Navbar.tsx (1)

152-159: ⚠️ Potential issue | 🟠 Major

Pass searchProductsTitle to mobile SearchInput as well.

Line 157 wires the CMS title only for desktop. In the mobile branch (Line 177-188), the prop is not forwarded, so the dropdown title customization won’t apply on mobile.

Proposed fix
             {!isDesktop && (
               <SearchInput
                 placeholder=""
                 ref={searchMobileRef}
                 testId="store-input-mobile"
                 buttonTestId="store-input-mobile-button"
                 onSearchClick={handlerExpandSearch}
                 sort={searchInput?.sort}
                 quickOrderSettings={searchInput?.quickOrderSettings}
+                searchProductsTitle={searchInput?.searchProductsTitle}
                 hidden={!searchExpanded}
                 aria-hidden={!searchExpanded}
               />
             )}

Also applies to: 177-188

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

In `@packages/core/src/components/navigation/Navbar/Navbar.tsx` around lines 152 -
159, The mobile rendering branch isn't passing the searchProductsTitle prop into
the SearchInput, so the CMS-configured dropdown title is only applied on
desktop; update the mobile branch that renders <SearchInput .../> (the branch
conditioned by isDesktop / its inverse) to include
searchProductsTitle={searchInput?.searchProductsTitle} alongside the existing
placeholder, sort, and quickOrderSettings props so both desktop and mobile use
the same CMS title.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In `@packages/core/src/components/navigation/Navbar/Navbar.tsx`:
- Around line 152-159: The mobile rendering branch isn't passing the
searchProductsTitle prop into the SearchInput, so the CMS-configured dropdown
title is only applied on desktop; update the mobile branch that renders
<SearchInput .../> (the branch conditioned by isDesktop / its inverse) to
include searchProductsTitle={searchInput?.searchProductsTitle} alongside the
existing placeholder, sort, and quickOrderSettings props so both desktop and
mobile use the same CMS title.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: b37c04d0-9c89-498b-a43c-ca62fe84a1bb

📥 Commits

Reviewing files that changed from the base of the PR and between c6e0f65 and 34833db.

📒 Files selected for processing (5)
  • packages/core/cms/faststore/sections.json
  • packages/core/src/components/navigation/Navbar/Navbar.tsx
  • packages/core/src/components/search/SearchDropdown/SearchDropdown.tsx
  • packages/core/src/components/search/SearchInput/SearchInput.tsx
  • packages/core/src/components/sections/Navbar/Navbar.tsx

…earchTop to be able to change and translate this text in the search input results
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: 1

🧹 Nitpick comments (2)
packages/core/src/components/search/SearchHistory/SearchHistory.tsx (1)

13-13: Remove local fallback to keep text centralized in CMS.

Line [13] hardcodes 'History', which reintroduces UI copy outside CMS/i18n flow. Prefer passing title through as-is.

♻️ Suggested change
-const SearchHistory = ({ title = 'History', ...props }: SearchHistoryProps) => {
+const SearchHistory = ({ title, ...props }: SearchHistoryProps) => {

Based on learnings: In the FastStore codebase, components intentionally do not provide fallback defaults for text props like alt, title, or labels so UI text comes from CMS configuration.

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

In `@packages/core/src/components/search/SearchHistory/SearchHistory.tsx` at line
13, The component SearchHistory currently supplies a local default title
('History') which bypasses CMS/i18n text management; remove the local fallback
by removing the default value in the component signature (change const
SearchHistory = ({ title = 'History', ...props }: SearchHistoryProps) => to
destructure without a default, e.g. ({ title, ...props }: SearchHistoryProps)),
ensure any internal uses of title handle undefined safely if needed, and rely on
callers/CMS to provide the title so UI copy remains centralized.
packages/core/src/components/search/SearchTop/SearchTop.tsx (1)

27-32: Avoid hardcoded default title in component layer.

Line [30] adds 'Top Search' fallback in the component. To keep copy centralized and translatable via CMS, prefer no local default.

♻️ Suggested change
 function SearchTop({
   topTerms = [],
   sort,
-  title = 'Top Search',
+  title,
   ...otherProps
 }: SearchTopProps) {

Based on learnings: In the FastStore codebase, components intentionally do not provide fallback defaults for text props like alt, title, or labels so UI text comes from CMS configuration.

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

In `@packages/core/src/components/search/SearchTop/SearchTop.tsx` around lines 27
- 32, The component SearchTop currently hardcodes a default title ('Top Search')
in its parameter list; remove that local fallback so UI text is sourced from
CMS/parent props instead: delete the "= 'Top Search'" default from the SearchTop
function signature, ensure SearchTopProps's title is optional (or accepts
undefined) so types compile, and audit/update any callers/tests of SearchTop to
supply the desired title from CMS/config; run typecheck and unit tests to
confirm no remaining assumptions about a local default.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@packages/core/cms/faststore/sections.json`:
- Around line 205-209: The default value for the searchProductsTitle property is
inconsistent with the existing Search schema; update the "searchProductsTitle"
entry in sections.json to use the same casing as the Search schema default
("Suggested products" instead of "Suggested Products") so labels are consistent
across search surfaces.

---

Nitpick comments:
In `@packages/core/src/components/search/SearchHistory/SearchHistory.tsx`:
- Line 13: The component SearchHistory currently supplies a local default title
('History') which bypasses CMS/i18n text management; remove the local fallback
by removing the default value in the component signature (change const
SearchHistory = ({ title = 'History', ...props }: SearchHistoryProps) => to
destructure without a default, e.g. ({ title, ...props }: SearchHistoryProps)),
ensure any internal uses of title handle undefined safely if needed, and rely on
callers/CMS to provide the title so UI copy remains centralized.

In `@packages/core/src/components/search/SearchTop/SearchTop.tsx`:
- Around line 27-32: The component SearchTop currently hardcodes a default title
('Top Search') in its parameter list; remove that local fallback so UI text is
sourced from CMS/parent props instead: delete the "= 'Top Search'" default from
the SearchTop function signature, ensure SearchTopProps's title is optional (or
accepts undefined) so types compile, and audit/update any callers/tests of
SearchTop to supply the desired title from CMS/config; run typecheck and unit
tests to confirm no remaining assumptions about a local default.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 052c3131-ecf9-47d3-9b45-5087538b4b36

📥 Commits

Reviewing files that changed from the base of the PR and between 34833db and d4cb4af.

📒 Files selected for processing (6)
  • packages/core/cms/faststore/sections.json
  • packages/core/src/components/search/SearchDropdown/SearchDropdown.tsx
  • packages/core/src/components/search/SearchHistory/SearchHistory.tsx
  • packages/core/src/components/search/SearchInput/SearchInput.tsx
  • packages/core/src/components/search/SearchTop/SearchTop.tsx
  • packages/core/src/components/sections/Navbar/Navbar.tsx
🚧 Files skipped from review as they are similar to previous changes (3)
  • packages/core/src/components/sections/Navbar/Navbar.tsx
  • packages/core/src/components/search/SearchDropdown/SearchDropdown.tsx
  • packages/core/src/components/search/SearchInput/SearchInput.tsx

Comment thread packages/core/cms/faststore/sections.json
…earchTop to be able to change and translate this text in the search input results
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: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@packages/core/src/components/navigation/Navbar/Navbar.tsx`:
- Around line 157-159: The desktop SearchInput is receiving the CMS title props
(searchHistoryTitle, searchTopTitle, searchProductsTitle) but the mobile
SearchInput instance is not; update the mobile SearchInput component (the
second/phone-rendered <SearchInput> in Navbar.tsx) to accept and pass through
the same props (searchHistoryTitle, searchTopTitle, searchProductsTitle) so
mobile dropdowns use CMS-provided labels; ensure you wire the exact prop names
used by the desktop instance to the mobile SearchInput component.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 55c772be-06d1-45d4-b651-a034ff557905

📥 Commits

Reviewing files that changed from the base of the PR and between d4cb4af and 70629e4.

📒 Files selected for processing (1)
  • packages/core/src/components/navigation/Navbar/Navbar.tsx

Comment thread packages/core/src/components/navigation/Navbar/Navbar.tsx
@mateuspontes
Copy link
Copy Markdown
Contributor

@evander-corebiz
Copy link
Copy Markdown
Author

Please, also update the new schema component for CMS here. https://github.com/evander-corebiz/faststore/blob/b3887ab789a880d73c3500d5a3f5ea84ede13fc1/packages/core/cms/faststore/components/cms_component__navbar.jsonc#L47

done

Comment thread packages/core/src/components/search/SearchTop/SearchTop.tsx Outdated
Comment thread packages/core/src/components/search/SearchTop/SearchTop.tsx Outdated
Comment thread packages/core/src/components/search/SearchHistory/SearchHistory.tsx
Comment thread packages/core/src/components/search/SearchHistory/SearchHistory.tsx Outdated
@evander-corebiz evander-corebiz force-pushed the fix/search-products-title branch from 40e9b29 to 6ed2866 Compare April 30, 2026 19:12
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