import { useState } from 'react'; import { TextInput, BtnWrapper, InputLabel, SelectInput, InputGroup } from '../../../styles/Components'; import Button from '../../common/button/Button'; import { SearchBarLayout } from '../../common/SearchBar'; import { blockPeriod, blockSanctions, blockSearchType, blockStatus } from '../../../assets/data'; import { userSearchType } from '../../../assets/data/options'; const UserBlockSearchBar = ({ handleSearch, setResultData }) => { const [searchData, setSearchData] = useState({ searchType: 'GUID', data: '', email: '', status: 'ALL', sanctions: 'ALL', period: 'ALL', }); const handleSubmit = event => { event.preventDefault(); handleSearch( searchData.searchType ? searchData.searchType : 'GUID', searchData.data, searchData.email, searchData.status ? searchData.status : 'ALL', searchData.sanctions ? searchData.sanctions : 'ALL', searchData.period ? searchData.period : 'ALL', ); setResultData(searchData); }; // 초기화 버튼 const handleReset = () => { setSearchData({ searchType: 'GUID', data: '', email: '', status: 'ALL', sanctions: 'ALL', period: 'ALL', }); handleSearch('GUID', '', '', 'ALL', 'ALL', 'ALL'); setResultData('GUID', '', '', 'ALL', 'ALL', 'ALL'); window.location.reload(); }; // console.log(searchData); const searchList = [ <> 대상 setSearchData({ ...searchData, searchType: e.target.value })}> {userSearchType.map((data, index) => ( ))} setSearchData({ ...searchData, data: e.target.value })} /> , <> 등록자 setSearchData({ ...searchData, email: e.target.value })} /> , ]; const optionList = [ <> 상태 setSearchData({ ...searchData, status: e.target.value })}> {blockStatus.map((data, index) => ( ))} , <> 제재 사유 setSearchData({ ...searchData, sanctions: e.target.value })}> {blockSanctions.map((data, index) => ( ))} , <> 제재 기간 setSearchData({ ...searchData, period: e.target.value })}> {blockPeriod.map((data, index) => ( ))} , ]; return ; }; export default UserBlockSearchBar;