diff --git a/ui/src/components/General/PopupSearch/PopSearch.module.scss b/ui/src/components/General/PopupSearch/PopSearch.module.scss index e64341ef..d661867f 100644 --- a/ui/src/components/General/PopupSearch/PopSearch.module.scss +++ b/ui/src/components/General/PopupSearch/PopSearch.module.scss @@ -10,10 +10,20 @@ display: flex; align-items: center; gap: 10px; - + margin: 5px; &:hover { background-color: aliceblue; } } + + &_item:first-child { + background-color: #b3b2b2; + border-radius: 5px; + } + + &_item:hover { + background-color: #d9d9d9 !important; + border-radius: 5px; + } } } diff --git a/ui/src/components/General/PopupSearch/index.tsx b/ui/src/components/General/PopupSearch/index.tsx index 69709a85..5ad35ffe 100644 --- a/ui/src/components/General/PopupSearch/index.tsx +++ b/ui/src/components/General/PopupSearch/index.tsx @@ -1,6 +1,6 @@ import { Input, InputRef, Modal } from "antd"; import { MENU_ITEMS } from "components/Layouts/Menu/utils/constants"; -import React, { useContext, useRef, useState } from "react"; +import React, { useContext, useEffect, useRef, useState } from "react"; import { useNavigate } from "react-router-dom"; import style from "./PopSearch.module.scss"; import Icon from "components/General/Icon"; @@ -18,6 +18,7 @@ const PopupSearch: React.FC = () => { const { isDarkMode } = useContext(DarkModeContext); const { handleModalOpen, isModalOpen } = useContext(SearchModalContext); const [input, setInput] = useState(""); + const [filteredItems, setFilteredItems] = useState(items); const searchInputRef = useRef(null); @@ -32,6 +33,14 @@ const PopupSearch: React.FC = () => { } }; + useEffect(() => { + setFilteredItems( + items.filter((item) => + item.name.toLowerCase().includes(input.toLowerCase()) + ) + ); + }, [input]); + useCombinedKeyPress(handleModalOpen, "KeyK"); return ( @@ -50,6 +59,10 @@ const PopupSearch: React.FC = () => { ref={searchInputRef} allowClear autoFocus + onPressEnter={() => { + filteredItems.length > 0 && + handleClick(filteredItems[0].url); + }} />
{ "search_container" )} > - {items - .filter((item) => - item.name.toLowerCase().includes(input.toLowerCase()) - ) - .map((item) => ( -
handleClick(item.url)} - > - -

{item?.name}

-
- ))} + {filteredItems.map((item) => ( +
handleClick(item.url)} + > + +

{item?.name}

+
+ ))}
); diff --git a/ui/src/pages/Home/components/Features.tsx b/ui/src/pages/Home/components/Features.tsx index 1668bee3..cce2139f 100644 --- a/ui/src/pages/Home/components/Features.tsx +++ b/ui/src/pages/Home/components/Features.tsx @@ -1,11 +1,14 @@ -import React from "react"; +import React, { useContext } from "react"; import { Button, Card, Col, Row, Space, Typography } from "antd"; import Icon from "components/General/Icon"; import { FEATURES } from "pages/Home/utils/constants"; import style from "pages/Home/Home.module.scss"; import { Link } from "react-router-dom"; +import { SearchModalContext } from "lib/utils/context/SearchModalProvider"; const Features: React.FC = () => { + const { handleModalOpen } = useContext(SearchModalContext); + return ( @@ -19,7 +22,7 @@ const Features: React.FC = () => { streamline your application development process - + diff --git a/ui/src/styles/antd-overrides.css b/ui/src/styles/antd-overrides.css index 2e24ea58..b2d73f33 100644 --- a/ui/src/styles/antd-overrides.css +++ b/ui/src/styles/antd-overrides.css @@ -123,7 +123,8 @@ a:hover { } .dark .search_container div:hover { - background-color: #817f7f !important; + background-color: #dddddd !important; + border-radius: 5px; } .dark .ant-input-affix-wrapper {