diff --git a/src/components/Search/Calculator.tsx b/src/components/Search/Calculator.tsx index 42ff4a44..97cb0a96 100644 --- a/src/components/Search/Calculator.tsx +++ b/src/components/Search/Calculator.tsx @@ -18,14 +18,7 @@ const Calculator: FC = (props) => { const renderItem = (result: string, description: string) => { return ( -
+
{result}
@@ -38,7 +31,12 @@ const Calculator: FC = (props) => { return (
{ copyToClipboard(result.value); }} diff --git a/src/components/Search/DropdownList.tsx b/src/components/Search/DropdownList.tsx index 6ef1ed6a..8e813cce 100644 --- a/src/components/Search/DropdownList.tsx +++ b/src/components/Search/DropdownList.tsx @@ -1,7 +1,6 @@ import { useEffect, useRef, useState, useCallback, MouseEvent } from "react"; import { CircleAlert, Bolt, X, ArrowBigRight } from "lucide-react"; import { isNil } from "lodash-es"; -import clsx from "clsx"; import { useDebounceFn, useUnmount } from "ahooks"; import { useTranslation } from "react-i18next"; @@ -33,7 +32,7 @@ function DropdownList({ isChatMode, }: DropdownListProps) { const { t } = useTranslation(); - + let globalIndex = 0; const globalItemIndexMap: any[] = []; @@ -46,7 +45,9 @@ function DropdownList({ const containerRef = useRef(null); const itemRefs = useRef<(HTMLDivElement | null)[]>([]); - const setSelectedSearchContent = useSearchStore((state) => state.setSelectedSearchContent); + const setSelectedSearchContent = useSearchStore( + (state) => state.setSelectedSearchContent + ); const hideArrowRight = (item: any) => { const categories = ["Calculator"]; @@ -242,28 +243,21 @@ function DropdownList({
)} - {items.map((hit: any, index: number) => { + {items.map((hit: any) => { const isSelected = selectedItem === globalIndex; const currentIndex = globalIndex; const item = hit.document; globalItemIndexMap.push(item); globalIndex++; - // TODO:https://lanhuapp.com/web/#/item/project/detailDetach?pid=fed58f5b-a117-4fe4-a521-c71f2e9b88c3&project_id=fed58f5b-a117-4fe4-a521-c71f2e9b88c3&image_id=a0afd01b-da7d-47c8-818b-90496fb28a71&fromEditor=true return ( -
+
{hideArrowRight(item) ? (
(itemRefs.current[currentIndex] = el)} onMouseEnter={() => setSelectedItem(currentIndex)} - className={clsx({ - "mt-1": !showHeader, - })} > - - {!showHeader && ( -
- )}
) : ( @@ -128,9 +128,6 @@ export default function ListRight({ rootClassName={clsx("!absolute", [ showIndex && currentIndex < 10 ? "right-9" : "right-2", ])} - shortcutClassName={clsx({ - "!shadow-[-6px_0px_6px_2px_#950599]": isSelected, - })} /> )} @@ -138,9 +135,6 @@ export default function ListRight({ )}
diff --git a/src/components/Search/SearchListItem.tsx b/src/components/Search/SearchListItem.tsx index d011d007..67803271 100644 --- a/src/components/Search/SearchListItem.tsx +++ b/src/components/Search/SearchListItem.tsx @@ -1,4 +1,5 @@ import React from "react"; +import clsx from "clsx"; import ItemIcon from "@/components/Common/Icons/ItemIcon"; import ListRight from "./ListRight"; @@ -38,11 +39,13 @@ const SearchListItem: React.FC = React.memo( ref={itemRef} onMouseEnter={onMouseEnter} onClick={onItemClick} - className={`w-full px-2 py-2.5 text-sm flex mb-0 flex-row items-center mobile:mb-2 mobile:flex-col mobile:items-start justify-between rounded-lg transition-colors cursor-pointer ${ - isSelected - ? "text-white bg-[var(--coco-primary-color)] hover:bg-[var(--coco-primary-color)]" - : "text-[#333] dark:text-[#d8d8d8] mobile:bg-gray-200/80 mobile:dark:bg-gray-700/50" - } ${showListRight ? "gap-7 mobile:gap-1" : ""}`} + className={clsx( + "w-full px-2 py-2.5 text-sm flex mb-0 flex-row items-center mobile:mb-2 mobile:flex-col mobile:items-start justify-between rounded-lg transition-colors cursor-pointer text-[#333] dark:text-[#d8d8d8] mobile:bg-gray-200/80 mobile:dark:bg-gray-700/50", + { + "bg-[#EDEDED] dark:bg-[#202126]": isSelected, + "gap-7 mobile:gap-1": showListRight, + } + )} >