diff --git a/FE/src/components/Search/SearchInput.tsx b/FE/src/components/Search/SearchInput.tsx
index 1f3bb6fa..3d698f9d 100644
--- a/FE/src/components/Search/SearchInput.tsx
+++ b/FE/src/components/Search/SearchInput.tsx
@@ -1,4 +1,5 @@
import { MagnifyingGlassIcon } from '@heroicons/react/16/solid';
+import { useEffect, useRef } from 'react';
interface SearchInputProps {
value: string;
@@ -6,6 +7,12 @@ interface SearchInputProps {
}
export function SearchInput({ value, onChange }: SearchInputProps) {
+ const inputRef = useRef
(null);
+
+ useEffect(() => {
+ inputRef.current?.focus();
+ }, []);
+
return (
+
+
+ {Array.from({ length: 30 }, (_, index) => {
+ return ;
+ })}
+
+ >
+ );
+}
diff --git a/FE/src/components/Search/index.tsx b/FE/src/components/Search/index.tsx
index 69ddd642..68aa7377 100644
--- a/FE/src/components/Search/index.tsx
+++ b/FE/src/components/Search/index.tsx
@@ -3,10 +3,12 @@ import useSearchModalStore from '../../store/useSearchModalStore';
import Overlay from '../../utils/ModalOveray';
import { SearchInput } from './SearchInput';
import { SearchHistoryList } from './SearchHistoryList';
+import SearchList from './SearchList.tsx';
+import useSearchInputStore from '../../store/useSearchInputStore.ts';
export default function SearchModal() {
const { isOpen, toggleSearchModal } = useSearchModalStore();
- const [searchTerm, setSearchTerm] = useState('');
+ const { searchInput, setSearchInput } = useSearchInputStore();
const [searchHistory, setSearchHistory] = useState
([]);
useEffect(() => {
@@ -22,13 +24,26 @@ export default function SearchModal() {
return (
<>
toggleSearchModal()} />
-
-
-
-
+
+
+
+
+
+
+
+ {searchInput === '' ? (
+ <>>
+ ) : (
+
+
+
+ )}
+
>
diff --git a/FE/src/components/TopFive/Nav.tsx b/FE/src/components/TopFive/Nav.tsx
index 941c8249..5fc2bef3 100644
--- a/FE/src/components/TopFive/Nav.tsx
+++ b/FE/src/components/TopFive/Nav.tsx
@@ -43,7 +43,7 @@ export default function Nav() {
key={market}
ref={(el) => (buttonRefs.current[index] = el)}
onClick={() => handleMarketChange(market)}
- className={`relative px-2 py-2`}
+ className={'relative px-2 py-2'}
>
{market}
diff --git a/FE/src/page/Home.tsx b/FE/src/page/Home.tsx
index d79f6fce..3ae5da96 100644
--- a/FE/src/page/Home.tsx
+++ b/FE/src/page/Home.tsx
@@ -1,6 +1,5 @@
import TopFive from 'components/TopFive/TopFive';
import StockIndex from 'components/StockIndex/index.tsx';
-import SearchModal from '../components/Search';
export default function Home() {
return (
diff --git a/FE/src/store/useSearchInputStore.ts b/FE/src/store/useSearchInputStore.ts
new file mode 100644
index 00000000..b6fe6451
--- /dev/null
+++ b/FE/src/store/useSearchInputStore.ts
@@ -0,0 +1,21 @@
+import { create } from 'zustand';
+
+interface SearchInputStore {
+ searchInput: string;
+ setSearchInput: (input: string) => void;
+ resetSearchInput: () => void;
+}
+
+const useSearchInputStore = create
((set) => ({
+ searchInput: '',
+
+ setSearchInput: (input: string) => {
+ set({ searchInput: input });
+ },
+
+ resetSearchInput: () => {
+ set({ searchInput: '' });
+ },
+}));
+
+export default useSearchInputStore;