Skip to content

Commit

Permalink
Merge pull request #1806 from AletheiaFact/migrate-inputSearch
Browse files Browse the repository at this point in the history
Migrate InputSearch
  • Loading branch information
thesocialdev authored Jan 30, 2025
2 parents 454a14e + 71c9dc1 commit 8d40cd3
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 15 deletions.
25 changes: 15 additions & 10 deletions src/components/Form/InputSearch.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import React from "react";
import { Input } from "antd";
import { TextField, InputAdornment } from "@mui/material";
import styled from "styled-components";
import colors from "../../styles/colors";

const InputSearchStyled = styled(Input.Search)`
span.ant-input-group-addon {
display: none;
const InputSearchStyled = styled(TextField)`
.MuiInputAdornment-root {
color: ${colors.primary};
}
span.ant-input-affix-wrapper {
.MuiOutlinedInput-root {
background: ${({ backgroundColor = colors.lightNeutral }) =>
backgroundColor};
box-shadow: 0px 2px 2px ${colors.shadow};
Expand All @@ -16,7 +16,7 @@ const InputSearchStyled = styled(Input.Search)`
border-color: ${colors.neutralTertiary};
}
}
input.ant-input {
.MuiOutlinedInput-input {
background: ${({ backgroundColor = colors.lightNeutral }) =>
backgroundColor};
color: ${colors.blackSecondary};
Expand Down Expand Up @@ -44,14 +44,19 @@ const InputSearch = (props) => {

return (
<InputSearchStyled
variant="outlined"
placeholder={props.placeholder || ""}
size="large"
loading={loading}
addonAfter={false}
addonBefore={false}
onChange={(e) => doSearch(e)}
suffix={props.suffix || <></>}
prefix={props.prefix || <></>}
InputProps={{
startAdornment: props.prefix ? (
<InputAdornment position="start">{props.prefix}</InputAdornment>
) : null,
endAdornment: props.suffix ? (
<InputAdornment position="end">{props.suffix}</InputAdornment>
) : null,
}}
data-cy={props["data-cy"] || "testInputSearchPersonality"}
{...props}
/>
Expand Down
12 changes: 9 additions & 3 deletions src/components/Home/HomeHeader/HomeHeaderSearch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import AletheiaButton, { ButtonType } from "../../Button";
import HomeHeaderSearchStyled from "./HomeHeaderSearch.style";
import { useAtom } from "jotai";
import { currentNameSpace } from "../../../atoms/namespace";
import { InputAdornment } from "@mui/material";

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

<InputSearch
sx={{ width: "100%" }}
placeholder={t("header:search_placeholder")}
prefix={
<SearchOutlined style={{ fontSize: 25, marginRight: 16 }} />
}
InputProps={{
startAdornment: (
<InputAdornment position="start">
<SearchOutlined />
</InputAdornment>
),
}}
data-cy={"testInputSearchOverlay"}
onChange={({ target }) => setName(target.value)}
onKeyDown={({ key }) => {
Expand Down
3 changes: 1 addition & 2 deletions src/components/Personality/PersonalityCreateSearch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,7 @@ const PersonalityCreateSearch = ({
} else {
router
.push(
`/${
nameSpace === NameSpaceEnum.Main ? "" : nameSpace
`/${nameSpace === NameSpaceEnum.Main ? "" : nameSpace
}${path}`
)
.catch((e) => e);
Expand Down
1 change: 1 addition & 0 deletions src/components/Search/OverlaySearchInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ const OverlaySearchInput = () => {

return (
<InputSearch
size="small"
placeholder={t("header:search_placeholder")}
callback={handleInputSearch}
suffix={<SearchOutlined />}
Expand Down

0 comments on commit 8d40cd3

Please sign in to comment.