-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
183 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
packages/frontend/src/components/layouts/search/Search.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { Button } from '@/components/ui/button'; | ||
import { Input } from '@/components/ui/input'; | ||
import { cn } from '@/utils/cn'; | ||
|
||
interface SearchProps { | ||
className?: string; | ||
} | ||
|
||
export const Search = ({ className }: SearchProps) => { | ||
const searchResult = ['']; | ||
|
||
return ( | ||
<div className={cn('bg-white p-10 shadow', className)}> | ||
<h3 className="display-bold24 mb-2">검색</h3> | ||
<p className="display-medium16 text-dark-gray mb-10"> | ||
주식을 검색하세요. | ||
</p> | ||
<div className="mb-8 flex gap-4"> | ||
<Input placeholder="검색어" /> | ||
<Button size="sm">검색</Button> | ||
</div> | ||
{searchResult.map((word) => ( | ||
// TODO: 추후 Link로 수정 | ||
<p className="text-dark-gray leading-7">{word}</p> | ||
))} | ||
</div> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './Search'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { type InputHTMLAttributes } from 'react'; | ||
import { cn } from '@/utils/cn'; | ||
|
||
interface InputProps extends InputHTMLAttributes<HTMLInputElement> { | ||
className?: string; | ||
} | ||
|
||
export const Input = ({ placeholder, className, ...props }: InputProps) => { | ||
return ( | ||
<input | ||
placeholder={placeholder} | ||
className={cn( | ||
'border-dark-gray w-36 border-b focus:outline-none', | ||
className, | ||
)} | ||
{...props} | ||
/> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './Input'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,24 @@ | ||
import { type ReactElement } from 'react'; | ||
import Bell from '@/assets/bell.svg?react'; | ||
import Home from '@/assets/home.svg?react'; | ||
import Search from '@/assets/search.svg?react'; | ||
import Stock from '@/assets/stock.svg?react'; | ||
import Theme from '@/assets/theme.svg?react'; | ||
import User from '@/assets/user.svg?react'; | ||
import { type MenuSection } from '@/types/menu'; | ||
|
||
export interface MenuItemData { | ||
icon: ReactElement; | ||
text: string; | ||
id: number; | ||
url?: string; | ||
} | ||
|
||
export const topMenuItems: MenuItemData[] = [ | ||
{ icon: <Search className="w-7" />, text: '검색', id: 1 }, | ||
{ icon: <Home className="w-7" />, text: '홈', id: 2, url: '/' }, | ||
{ icon: <Stock className="w-7" />, text: '주식', id: 3, url: '/stocks' }, | ||
{ icon: <Bell className="w-7" />, text: '알림', id: 4 }, | ||
export const TOP_MENU_ITEMS: MenuSection[] = [ | ||
{ id: 1, icon: <Search className="w-7" />, text: '검색' }, | ||
{ id: 2, icon: <Home className="w-7" />, text: '홈', path: '/' }, | ||
{ id: 3, icon: <Stock className="w-7" />, text: '주식', path: '/stocks' }, | ||
{ id: 4, icon: <Bell className="w-7" />, text: '알림' }, | ||
]; | ||
|
||
export const bottomMenuItems: MenuItemData[] = [ | ||
{ icon: <Theme className="w-7" />, text: '다크모드', id: 1 }, | ||
export const BOTTOM_MENU_ITEMS: MenuSection[] = [ | ||
{ id: 1, icon: <Theme className="w-7" />, text: '다크모드' }, | ||
{ | ||
id: 2, | ||
icon: <User className="w-7" />, | ||
text: '마이페이지', | ||
id: 2, | ||
url: '/my-page', | ||
path: '/my-page', | ||
}, | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { useEffect, useRef } from 'react'; | ||
|
||
export const useOutsideClick = (callback: () => void) => { | ||
const ref = useRef<HTMLDivElement>(null); | ||
|
||
useEffect(() => { | ||
const handleClickOutside = (event: MouseEvent | TouchEvent) => { | ||
if (!ref.current?.contains(event.target as Node)) { | ||
callback(); | ||
} | ||
}; | ||
|
||
document.addEventListener('mouseup', handleClickOutside); | ||
document.addEventListener('touchend', handleClickOutside); | ||
|
||
return () => { | ||
document.removeEventListener('mouseup', handleClickOutside); | ||
document.removeEventListener('touchend', handleClickOutside); | ||
}; | ||
}, [callback]); | ||
|
||
return ref; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
packages/frontend/src/pages/stocks/components/StockIndexCard.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { type ReactNode } from 'react'; | ||
|
||
export interface MenuSection { | ||
id: number; | ||
icon: ReactNode; | ||
text: string; | ||
path?: string; | ||
} |