Skip to content

Commit

Permalink
💄 style(custom): 手机端搜索栏样式修改,pc端高级搜索当无输入内容时展示默认内容
Browse files Browse the repository at this point in the history
  • Loading branch information
master1lan committed Mar 1, 2023
1 parent e6d0048 commit edd527f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
3 changes: 3 additions & 0 deletions config/vite.master.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ export default mergeConfig(
react: ["react", "react-dom"],
"react-router": ["react-router-dom"],
"react-redux": ["@reduxjs/toolkit", "react-redux"],
masonic: ["masonic"],
sentry: ["@sentry/react", "@sentry/tracing"],
axios: ["axios"],
lib: [
"@mui/icons-material",
Expand All @@ -104,6 +106,7 @@ export default mergeConfig(
"react-intersection-observer",
"dayjs",
],
"react-photo-view": ["react-photo-view"],
},
},
},
Expand Down
2 changes: 1 addition & 1 deletion src/routers/layout/header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const ReactiveHeader = memo(() => {
return (
<header className='border-t-2 z-10 max-md:border-b-2 sticky top-0 bg-white'>
{/* 手机端 */}
<div className='hidden max-sm:flex px-6 pt-2'>
<div className='hidden max-sm:flex px-6 pb-3 pt-4'>
<Search />
</div>
{/* pc端和平板端header部 */}
Expand Down
8 changes: 6 additions & 2 deletions src/routers/layout/search/pc/search.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -119,13 +119,15 @@ const AdvanceSearchItem = forwardRef<HTMLInputElement, AdvanceItemProps>(
(props, ref) => {
const { inputRef, handerfocus } = useBackRef(ref);
const { focused } = useSearchFocus();
const inptValue = inputRef.current?.value,
showedTitle = focused ? props.title : inptValue ? inptValue : props.title;
return (
<>
<div
className={`${pcStyles["SearchItem"]} ${pcStyles["itemPadding"]} ${pcStyles["item"]}`}
onClick={handerfocus}
>
<span>{focused ? props.title : inputRef.current?.value}</span>
<span>{showedTitle}</span>
<input
ref={inputRef}
autoComplete='off'
Expand All @@ -149,6 +151,8 @@ const AdvanceSearchLastItem = forwardRef<
>((props, ref) => {
const { inputRef, handerfocus } = useBackRef(ref);
const { focused } = useSearchFocus();
const inptValue = inputRef.current?.value,
showedTitle = focused ? props.title : inptValue ? inptValue : props.title;
return (
<>
<div
Expand All @@ -158,7 +162,7 @@ const AdvanceSearchLastItem = forwardRef<
<div
className={`flex-grow ${pcStyles["itemPadding"]} ${pcStyles["item"]}`}
>
<span>{focused ? props.title : inputRef.current?.value}</span>
<span>{showedTitle}</span>
<input
ref={inputRef}
autoComplete='off'
Expand Down

0 comments on commit edd527f

Please sign in to comment.