Skip to content

Commit 8d40cd3

Browse files
authored
Merge pull request #1806 from AletheiaFact/migrate-inputSearch
Migrate InputSearch
2 parents 454a14e + 71c9dc1 commit 8d40cd3

File tree

4 files changed

+26
-15
lines changed

4 files changed

+26
-15
lines changed

src/components/Form/InputSearch.tsx

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import React from "react";
2-
import { Input } from "antd";
2+
import { TextField, InputAdornment } from "@mui/material";
33
import styled from "styled-components";
44
import colors from "../../styles/colors";
55

6-
const InputSearchStyled = styled(Input.Search)`
7-
span.ant-input-group-addon {
8-
display: none;
6+
const InputSearchStyled = styled(TextField)`
7+
.MuiInputAdornment-root {
8+
color: ${colors.primary};
99
}
10-
span.ant-input-affix-wrapper {
10+
.MuiOutlinedInput-root {
1111
background: ${({ backgroundColor = colors.lightNeutral }) =>
1212
backgroundColor};
1313
box-shadow: 0px 2px 2px ${colors.shadow};
@@ -16,7 +16,7 @@ const InputSearchStyled = styled(Input.Search)`
1616
border-color: ${colors.neutralTertiary};
1717
}
1818
}
19-
input.ant-input {
19+
.MuiOutlinedInput-input {
2020
background: ${({ backgroundColor = colors.lightNeutral }) =>
2121
backgroundColor};
2222
color: ${colors.blackSecondary};
@@ -44,14 +44,19 @@ const InputSearch = (props) => {
4444

4545
return (
4646
<InputSearchStyled
47+
variant="outlined"
4748
placeholder={props.placeholder || ""}
4849
size="large"
4950
loading={loading}
50-
addonAfter={false}
51-
addonBefore={false}
5251
onChange={(e) => doSearch(e)}
53-
suffix={props.suffix || <></>}
54-
prefix={props.prefix || <></>}
52+
InputProps={{
53+
startAdornment: props.prefix ? (
54+
<InputAdornment position="start">{props.prefix}</InputAdornment>
55+
) : null,
56+
endAdornment: props.suffix ? (
57+
<InputAdornment position="end">{props.suffix}</InputAdornment>
58+
) : null,
59+
}}
5560
data-cy={props["data-cy"] || "testInputSearchPersonality"}
5661
{...props}
5762
/>

src/components/Home/HomeHeader/HomeHeaderSearch.tsx

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import AletheiaButton, { ButtonType } from "../../Button";
1010
import HomeHeaderSearchStyled from "./HomeHeaderSearch.style";
1111
import { useAtom } from "jotai";
1212
import { currentNameSpace } from "../../../atoms/namespace";
13+
import { InputAdornment } from "@mui/material";
1314

1415
const HomeHeaderSearch = () => {
1516
const { t } = useTranslation();
@@ -45,10 +46,15 @@ const HomeHeaderSearch = () => {
4546
<h2 className="title">{t("home:homeHeaderSearchTitle")}</h2>
4647

4748
<InputSearch
49+
sx={{ width: "100%" }}
4850
placeholder={t("header:search_placeholder")}
49-
prefix={
50-
<SearchOutlined style={{ fontSize: 25, marginRight: 16 }} />
51-
}
51+
InputProps={{
52+
startAdornment: (
53+
<InputAdornment position="start">
54+
<SearchOutlined />
55+
</InputAdornment>
56+
),
57+
}}
5258
data-cy={"testInputSearchOverlay"}
5359
onChange={({ target }) => setName(target.value)}
5460
onKeyDown={({ key }) => {

src/components/Personality/PersonalityCreateSearch.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,7 @@ const PersonalityCreateSearch = ({
5858
} else {
5959
router
6060
.push(
61-
`/${
62-
nameSpace === NameSpaceEnum.Main ? "" : nameSpace
61+
`/${nameSpace === NameSpaceEnum.Main ? "" : nameSpace
6362
}${path}`
6463
)
6564
.catch((e) => e);

src/components/Search/OverlaySearchInput.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ const OverlaySearchInput = () => {
4848

4949
return (
5050
<InputSearch
51+
size="small"
5152
placeholder={t("header:search_placeholder")}
5253
callback={handleInputSearch}
5354
suffix={<SearchOutlined />}

0 commit comments

Comments
 (0)