import { TextInput, BtnWrapper, InputLabel, SelectInput } from '../../styles/Components';
import Button from '../common/button/Button';
import { SearchBarLayout, SearchPeriod } from '../common/SearchBar';
import { useState } from 'react';
import { eventStatus } from '../../assets/data';
const EventListSearchBar = ({ handleSearch, setResultData }) => {
const [searchData, setSearchData] = useState({
title: '',
content: '',
status: 'ALL',
startDate: '',
endDate: '',
});
const handleSubmit = event => {
event.preventDefault();
handleSearch(
searchData.title,
searchData.content,
searchData.status ? searchData.status : 'ALL',
searchData.startDate ? searchData.startDate : '',
searchData.endDate ? searchData.endDate : new Date(),
(searchData.startDate && searchData.endDate === '') && setSearchData({ startDate : searchData.startDate ,endDate : new Date()}),
);
setResultData(searchData);
};
const handleReset = () => {
setSearchData({
title: '',
content: '',
status: 'ALL',
startDate: '',
endDate: '',
order: 'DESC',
});
handleSearch('', '', 'ALL', '', '');
setResultData('', '', 'ALL', '', '');
window.location.reload();
};
// console.log("searchData.endDate", searchData.endDate)
const searchList = [
<>
우편 제목
setSearchData({ ...searchData, title: e.target.value })}
/>
>,
<>
조회 일자
{
setSearchData({ ...searchData, startDate: data });
}}
endDate={searchData.endDate}
handleEndDate={data => setSearchData({ ...searchData, endDate: data })}
/>
>,
<>
우편 내용
setSearchData({ ...searchData, content: e.target.value })}
/>
>
];
const optionList = [
<>
이벤트 상태
setSearchData({ ...searchData, status: e.target.value })}>
{eventStatus.map((data, index) => (
))}
>,
];
return ;
};
export default EventListSearchBar;