Skip to content

Commit 1bdf9fa

Browse files
committed
Put the search bar button over the input when in realtime search (the user has not provider a on click) so that the input dosen't get resized
1 parent 26c3917 commit 1bdf9fa

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

src/SearchBar/SearchButton.tsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ import { is } from "tsafe/is";
88
import { useConstCallback } from "../tools/powerhooks/useConstCallback";
99
import { observeInputValue } from "../tools/observeInputValue";
1010
import { id } from "tsafe/id";
11+
import { cx } from "../tools/cx";
12+
import "../assets/search-bar-button.css";
1113

1214
export type SearchButtonProps = {
1315
searchInputId: string;
@@ -147,7 +149,14 @@ export function SearchButton(props: SearchButtonProps) {
147149
}
148150

149151
return (
150-
<button className={fr.cx("fr-btn")} title={t("label")} onClick={onClick}>
152+
<button
153+
className={cx(
154+
onClick_props === undefined && "controlled-search-bar-button",
155+
fr.cx("fr-btn")
156+
)}
157+
title={t("label")}
158+
onClick={onClick}
159+
>
151160
{t("label")}
152161
</button>
153162
);

src/assets/search-bar-button.css

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
.controlled-search-bar-button.fr-btn {
2+
position: absolute;
3+
right: 24px;
4+
}
5+
6+
@media (max-width:62em) {
7+
.controlled-search-bar-button.fr-btn {
8+
right: 16px;
9+
}
10+
}

0 commit comments

Comments
 (0)