77 type SearchValues ,
88 type StudyRegion ,
99} from "../../../../domain/types.ts" ;
10+ import { useText } from "@shared/locale/ui-text.ts" ;
1011
1112type Props = {
1213 value ?: SearchValues ;
@@ -28,24 +29,8 @@ const toCategoryOrEmpty = (value: string): Category | "" => {
2829 return isCategory ( value ) ? value : "" ;
2930} ;
3031
31- const REGION_LABELS : Record < StudyRegion | "" , string > = {
32- "" : "All" ,
33- Africa : "Africa" ,
34- Asia : "Asia" ,
35- Europe : "Europe" ,
36- "North America" : "North America" ,
37- "South America" : "South America" ,
38- Oceania : "Oceania" ,
39- } ;
40-
41- const CATEGORY_LABELS : Record < Category | "" , string > = {
42- "" : "All" ,
43- Cultural : "Cultural" ,
44- Natural : "Natural" ,
45- Mixed : "Mixed" ,
46- } ;
47-
4832export function HeritageSearchForm ( { value, onChange, onSubmit } : Props ) {
33+ const text = useText ( ) ;
4934 const regionOptions : readonly ( StudyRegion | "" ) [ ] = [ "" , ...STUDY_REGIONS ] ;
5035 const categoryOptions : readonly ( Category | "" ) [ ] = [ "" , ...CATEGORIES ] ;
5136
@@ -85,7 +70,7 @@ export function HeritageSearchForm({ value, onChange, onSubmit }: Props) {
8570 >
8671 { /* Region チップ */ }
8772 < div className = "px-4 pt-3 pb-2 border-b border-zinc-100" >
88- < div className = "text-[11px] font-semibold text-zinc-400 mb-2" > Region </ div >
73+ < div className = "text-[11px] font-semibold text-zinc-400 mb-2" > { text . region } </ div >
8974 < div className = "flex flex-wrap gap-2" >
9075 { regionOptions . map ( ( opt ) => {
9176 const isActive = searchValues . region === opt ;
@@ -103,7 +88,7 @@ export function HeritageSearchForm({ value, onChange, onSubmit }: Props) {
10388 }
10489 ` }
10590 >
106- { REGION_LABELS [ opt ] }
91+ { opt === "" ? text . all : text . regionLabels [ opt ] }
10792 </ button >
10893 ) ;
10994 } ) }
@@ -112,7 +97,7 @@ export function HeritageSearchForm({ value, onChange, onSubmit }: Props) {
11297
11398 { /* Category チップ */ }
11499 < div className = "px-4 pt-3 pb-2 border-b border-zinc-100" >
115- < div className = "text-[11px] font-semibold text-zinc-400 mb-2" > Category </ div >
100+ < div className = "text-[11px] font-semibold text-zinc-400 mb-2" > { text . category } </ div >
116101 < div className = "flex flex-wrap gap-2" >
117102 { categoryOptions . map ( ( opt ) => {
118103 const isActive = searchValues . category === opt ;
@@ -130,7 +115,7 @@ export function HeritageSearchForm({ value, onChange, onSubmit }: Props) {
130115 }
131116 ` }
132117 >
133- { CATEGORY_LABELS [ opt ] }
118+ { opt === "" ? text . all : text . categoryLabels [ opt ] }
134119 </ button >
135120 ) ;
136121 } ) }
@@ -142,40 +127,40 @@ export function HeritageSearchForm({ value, onChange, onSubmit }: Props) {
142127 { /* Year */ }
143128 < div className = "flex items-center gap-3 px-4 py-3 sm:border-r sm:border-zinc-100 sm:w-[220px] shrink-0" >
144129 < div className = "flex-1 min-w-0" >
145- < div className = "text-[11px] font-semibold text-zinc-500" > Year Inscribed </ div >
130+ < div className = "text-[11px] font-semibold text-zinc-500" > { text . yearInscribed } </ div >
146131 < div className = "flex items-center gap-1" >
147132 < input
148133 type = "number"
149134 inputMode = "numeric"
150135 value = { searchValues . yearInscribedFrom }
151136 onChange = { ( e ) => set ( { yearInscribedFrom : e . target . value } ) }
152- placeholder = "From"
137+ placeholder = { text . yearFrom }
153138 className = "w-full bg-transparent text-sm font-semibold text-zinc-900 placeholder:text-zinc-400 placeholder:font-normal focus:outline-none"
154- aria-label = "Year inscribed from"
139+ aria-label = { ` ${ text . yearInscribed } ${ text . yearFrom } ` }
155140 />
156141 < span className = "text-zinc-300" > –</ span >
157142 < input
158143 type = "number"
159144 inputMode = "numeric"
160145 value = { searchValues . yearInscribedTo }
161146 onChange = { ( e ) => set ( { yearInscribedTo : e . target . value } ) }
162- placeholder = "To"
147+ placeholder = { text . yearTo }
163148 className = "w-full bg-transparent text-sm font-semibold text-zinc-900 placeholder:text-zinc-400 placeholder:font-normal focus:outline-none"
164- aria-label = "Year inscribed to"
149+ aria-label = { ` ${ text . yearInscribed } ${ text . yearTo } ` }
165150 />
166151 </ div >
167152 </ div >
168153 </ div >
169154 { /* Keyword + Submit */ }
170155 < div className = "flex flex-1 items-center gap-3 px-4 py-3" >
171156 < div className = "flex-1 min-w-0" >
172- < div className = "text-[11px] font-semibold text-zinc-500" > Keyword </ div >
157+ < div className = "text-[11px] font-semibold text-zinc-500" > { text . keyword } </ div >
173158 < input
174159 value = { searchValues . keyword }
175160 onChange = { ( e ) => set ( { keyword : e . target . value } ) }
176- placeholder = "Name / Country"
161+ placeholder = { text . keywordPlaceholder }
177162 className = "w-full bg-transparent text-sm font-semibold text-zinc-900 placeholder:text-zinc-400 placeholder:font-normal focus:outline-none"
178- aria-label = "Keyword"
163+ aria-label = { text . keyword }
179164 />
180165 </ div >
181166
@@ -187,10 +172,10 @@ export function HeritageSearchForm({ value, onChange, onSubmit }: Props) {
187172 hover:bg-rose-700 transition-colors
188173 focus:outline-none focus-visible:ring-2 focus-visible:ring-rose-400
189174 "
190- aria-label = "Search"
175+ aria-label = { text . search }
191176 >
192177 < SearchIcon fontSize = "small" />
193- < span > Search </ span >
178+ < span > { text . search } </ span >
194179 </ button >
195180 </ div >
196181 </ div >
0 commit comments