/** * 종목 선택 다이얼로그 */ import React, { useState } from 'react'; import { Dialog, DialogTitle, DialogContent, TextField, InputAdornment, List, ListItemButton, ListItemText, } from '@mui/material'; import { Search as SearchIcon } from '@mui/icons-material'; import { MARKET_LIST } from '../../constants/marketList'; import type { StockInfo } from '../../stores/useDashboardStore'; interface StockSelectDialogProps { open: boolean; onClose: () => void; onSelect: (stock: StockInfo) => void; } export const StockSelectDialog: React.FC = ({ open, onClose, onSelect }) => { const [search, setSearch] = useState(''); const filtered = MARKET_LIST.filter( (m) => m.koreanName.toLowerCase().includes(search.toLowerCase()) || m.symbol.toLowerCase().includes(search.toLowerCase()) ); const handleSelect = (item: (typeof MARKET_LIST)[0]) => { onSelect({ symbol: item.symbol, koreanName: item.koreanName, englishName: item.englishName, }); onClose(); setSearch(''); }; return ( 종목 추가 setSearch(e.target.value)} fullWidth sx={{ mb: 1 }} InputProps={{ startAdornment: ( ), }} /> {filtered.map((item) => ( handleSelect(item)}> ))} ); };