Skip to content
Draft
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
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ class SearchBox extends Component<
rootProps={{
className: cssClasses.submit,
type: 'submit',
title: 'Submit the search query',
title: templates.submitTitle,
hidden: !showSubmit,
}}
templates={templates}
Expand All @@ -220,7 +220,7 @@ class SearchBox extends Component<
rootProps={{
className: cssClasses.reset,
type: 'reset',
title: 'Clear the search query',
title: templates.resetTitle,
hidden: !(
showReset &&
this.state.query.trim() &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ const defaultTemplate: SearchBoxComponentTemplates = {
</svg>
);
},
resetTitle: 'Clear the search query',
submit({ cssClasses }) {
return (
<svg
Expand All @@ -30,6 +31,7 @@ const defaultTemplate: SearchBoxComponentTemplates = {
</svg>
);
},
submitTitle: 'Submit the search query',
loadingIndicator({ cssClasses }) {
/* eslint-disable react/no-unknown-property */
// Preact supports kebab case attributes, and using camel case would
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,18 @@ export type SearchBoxTemplates = Partial<{
* Template used for displaying the submit button. Can accept a function or a Hogan string.
*/
submit: Template<{ cssClasses: SearchBoxComponentCSSClasses }>;
/**
* Template used for alternative text for the submit button icon. Only accepts a string.
*/
submitTitle: string;
/**
* Template used for displaying the reset button. Can accept a function or a Hogan string.
*/
reset: Template<{ cssClasses: SearchBoxComponentCSSClasses }>;
/**
* Template used for alternative text for the reset button icon. Only accepts a string.
*/
resetTitle: string;
/**
* Template used for displaying the loading indicator. Can accept a function or a Hogan string.
*/
Expand Down