Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .changeset/sour-ducks-hug.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
"@bigcommerce/catalyst-core": patch
---

Add translations for 'Search' button on 404 page

## Migration

1. Add `"search"` translation key in the `"NotFound"` translations
2. In `core/vibes/soul/sections/not-found/index.tsx`, add a `ctaLabel` property and ensure it is used in place of the "Search" text
3. In `core/app/[locale]/not-found.tsx`, pass the `ctaLabel` prop as the new translation key `ctaLabel={t('search')}`
1 change: 1 addition & 0 deletions core/app/[locale]/not-found.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export default async function NotFound() {

<NotFoundSection
className="flex-1 place-content-center"
ctaLabel={t('search')}
subtitle={t('subtitle')}
title={t('title')}
/>
Expand Down
3 changes: 2 additions & 1 deletion core/messages/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,8 @@
"NotFound": {
"title": "We couldn't find that page!",
"subtitle": "Try searching for something else or go back to the home page.",
"featuredProducts": "Featured products"
"featuredProducts": "Featured products",
"search": "Search"
},
"Components": {
"Header": {
Expand Down
4 changes: 3 additions & 1 deletion core/vibes/soul/sections/not-found/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { useSearch } from '~/context/search-context';
export interface NotFoundProps {
title?: string;
subtitle?: string;
ctaLabel?: string;
className?: string;
}

Expand All @@ -27,6 +28,7 @@ export interface NotFoundProps {
export function NotFound({
title = 'Not found',
subtitle = "Take a look around if you're lost.",
ctaLabel = 'Search',
className = '',
}: NotFoundProps) {
const { setIsSearchOpen } = useSearch();
Expand All @@ -44,7 +46,7 @@ export function NotFound({
<p className="mb-4 text-lg text-[var(--not-found-subtitle,hsl(var(--contrast-500)))]">
{subtitle}
</p>
<Button onClick={handleOpenSearch}>Search</Button>
<Button onClick={handleOpenSearch}>{ctaLabel}</Button>
</header>
</SectionLayout>
);
Expand Down