### What problem does this PR solve? feat: Cover the entire search page with a background image #2247 ### Type of change - [x] New Feature (non-breaking change which adds functionality)tags/v0.11.0
| .searchPage { | .searchPage { | ||||
| background-position: center; | |||||
| background-size: cover; | |||||
| .card { | .card { | ||||
| width: 100%; | width: 100%; | ||||
| :global(.ant-card-body) { | :global(.ant-card-body) { | ||||
| font-size: 14px; | font-size: 14px; | ||||
| cursor: pointer; | cursor: pointer; | ||||
| } | } | ||||
| .mainLayout { | |||||
| background: transparent; | |||||
| } | |||||
| } | |||||
| .transparentSearchSide { | |||||
| background-color: rgb(251 251 251 / 88%) !important; | |||||
| } | } | ||||
| .searchSide { | .searchSide { | ||||
| // height: calc(100vh - 72px); | |||||
| position: relative; | position: relative; | ||||
| // position: fixed !important; | |||||
| // top: 72px; | |||||
| // bottom: 0; | |||||
| :global(.ant-layout-sider-children) { | :global(.ant-layout-sider-children) { | ||||
| height: auto; | height: auto; | ||||
| } | } | ||||
| } | } | ||||
| .list { | .list { | ||||
| width: 100%; | width: 100%; | ||||
| // height: 100%; | |||||
| height: calc(100vh - 152px); | height: calc(100vh - 152px); | ||||
| overflow: auto; | overflow: auto; | ||||
| &::-webkit-scrollbar-track { | |||||
| background: transparent; | |||||
| } | |||||
| } | } | ||||
| .checkbox { | .checkbox { | ||||
| width: 100%; | width: 100%; | ||||
| .firstRenderContent { | .firstRenderContent { | ||||
| height: 100%; | height: 100%; | ||||
| background-position: center; | |||||
| background-size: cover; | |||||
| } | } | ||||
| .content { | .content { |
| return ( | return ( | ||||
| <> | <> | ||||
| <Layout className={styles.searchPage}> | |||||
| <Layout | |||||
| className={styles.searchPage} | |||||
| style={{ backgroundImage: `url(${imgUrl})` }} | |||||
| > | |||||
| <SearchSidebar | <SearchSidebar | ||||
| isFirstRender={isFirstRender} | |||||
| checkedList={checkedList} | checkedList={checkedList} | ||||
| setCheckedList={setCheckedList} | setCheckedList={setCheckedList} | ||||
| ></SearchSidebar> | ></SearchSidebar> | ||||
| <Layout> | |||||
| <Layout className={isFirstRender ? styles.mainLayout : ''}> | |||||
| <Content> | <Content> | ||||
| {isFirstRender ? ( | {isFirstRender ? ( | ||||
| <Flex | <Flex | ||||
| justify="center" | justify="center" | ||||
| align="center" | align="center" | ||||
| className={styles.firstRenderContent} | className={styles.firstRenderContent} | ||||
| style={{ backgroundImage: `url(${imgUrl})` }} | |||||
| > | > | ||||
| <Flex vertical align="center" gap={'large'}> | <Flex vertical align="center" gap={'large'}> | ||||
| {/* <Space size={30}> | |||||
| <img src="/logo.svg" alt="" className={styles.appIcon} /> | |||||
| <span className={styles.appName}>{appConf.appName}</span> | |||||
| </Space> */} | |||||
| {InputSearch} | {InputSearch} | ||||
| </Flex> | </Flex> | ||||
| </Flex> | </Flex> |
| import { useNextFetchKnowledgeList } from '@/hooks/knowledge-hooks'; | import { useNextFetchKnowledgeList } from '@/hooks/knowledge-hooks'; | ||||
| import { UserOutlined } from '@ant-design/icons'; | |||||
| import type { CheckboxProps } from 'antd'; | import type { CheckboxProps } from 'antd'; | ||||
| import { Avatar, Checkbox, Layout, List, Space, Typography } from 'antd'; | import { Avatar, Checkbox, Layout, List, Space, Typography } from 'antd'; | ||||
| import { CheckboxChangeEvent } from 'antd/es/checkbox'; | |||||
| import { CheckboxValueType } from 'antd/es/checkbox/Group'; | import { CheckboxValueType } from 'antd/es/checkbox/Group'; | ||||
| import classNames from 'classnames'; | |||||
| import { | import { | ||||
| Dispatch, | Dispatch, | ||||
| SetStateAction, | SetStateAction, | ||||
| useMemo, | useMemo, | ||||
| } from 'react'; | } from 'react'; | ||||
| import { UserOutlined } from '@ant-design/icons'; | |||||
| import { CheckboxChangeEvent } from 'antd/es/checkbox'; | |||||
| import styles from './index.less'; | import styles from './index.less'; | ||||
| const { Sider } = Layout; | const { Sider } = Layout; | ||||
| interface IProps { | interface IProps { | ||||
| isFirstRender: boolean; | |||||
| checkedList: string[]; | checkedList: string[]; | ||||
| setCheckedList: Dispatch<SetStateAction<string[]>>; | setCheckedList: Dispatch<SetStateAction<string[]>>; | ||||
| } | } | ||||
| const SearchSidebar = ({ checkedList, setCheckedList }: IProps) => { | |||||
| const SearchSidebar = ({ | |||||
| isFirstRender, | |||||
| checkedList, | |||||
| setCheckedList, | |||||
| }: IProps) => { | |||||
| const { list, loading } = useNextFetchKnowledgeList(); | const { list, loading } = useNextFetchKnowledgeList(); | ||||
| const ids = useMemo(() => list.map((x) => x.id), [list]); | const ids = useMemo(() => list.map((x) => x.id), [list]); | ||||
| }, [ids, setCheckedList]); | }, [ids, setCheckedList]); | ||||
| return ( | return ( | ||||
| <Sider className={styles.searchSide} theme={'light'} width={240}> | |||||
| <Sider | |||||
| className={classNames(styles.searchSide, { | |||||
| [styles.transparentSearchSide]: isFirstRender, | |||||
| })} | |||||
| theme={'light'} | |||||
| width={240} | |||||
| > | |||||
| <Checkbox | <Checkbox | ||||
| className={styles.modelForm} | className={styles.modelForm} | ||||
| indeterminate={indeterminate} | indeterminate={indeterminate} |