feat(Search): make search placeholder text configurable
This commit is contained in:
committed by
Bastian
parent
c8a3b528b8
commit
1f01f6ccb6
@@ -1,4 +1,5 @@
|
||||
import React, { FormEvent } from "react";
|
||||
import { useMessages } from "../../context/MessagesContext";
|
||||
import classNames from "classnames";
|
||||
import "./search.scss";
|
||||
|
||||
@@ -18,6 +19,7 @@ function Search(
|
||||
{ value, onChange, onClose, open = false, onSubmit = () => {} }: SearchProps,
|
||||
ref: any
|
||||
) {
|
||||
const { searchPlaceholder } = useMessages();
|
||||
const closable = onClose !== undefined;
|
||||
|
||||
const handleSubmit = (e: FormEvent) => {
|
||||
@@ -44,7 +46,7 @@ function Search(
|
||||
onChange(e.target.value);
|
||||
}}
|
||||
className="search__field"
|
||||
placeholder="What are you looking for?"
|
||||
placeholder={searchPlaceholder}
|
||||
ref={ref}
|
||||
/>
|
||||
<span className={classNames("search__button", { "is-open": open })}>
|
||||
|
||||
@@ -32,6 +32,7 @@ export interface Messages {
|
||||
socialLinks?: SocialLink[];
|
||||
legalInformationLink?: string;
|
||||
pageHelp?: PageHelp;
|
||||
searchPlaceholder?: string;
|
||||
}
|
||||
|
||||
const MessagesContext = createContext<Messages | undefined>(undefined);
|
||||
|
||||
Reference in New Issue
Block a user