- 진행기간 : 10/07 ~ 10/10
- 과제주관 : (주)바딧
- 참여명단 : 김민욱, 소재현, 손소희, 유광현, 정훈조, 조민재
- DEMO : DEMO
MISSION 1
- TypeScript 사용함에 CustomType 적용
//TableHeader.tsx
<Sorter
width={header.getSize()}
isSortable={header.column.getCanSort()}
onClick={header.column.getToggleSortingHandler()}
>
{header.isPlaceholder
? null
: flexRender(header.column.columnDef.header, header.getContext())}
{
{
asc: <FaSortUp />,
desc: <FaSortDown />,
}[header.column.getIsSorted() as SortDirection]
}
</Sorter>
...
const Sorter = styled.div<CustomSorter>`
width: ${({ width }) => width};
cursor: ${({ isSortable }) => (isSortable ? "pointer" : "default")};
-
react-table 라이브러리의 필터링 관련 함수들을 import하여 필터링 기능을 구현하였습니다.
각 열이 필터링이 가능한지 아닌지 여부를 판단하기 위해 getCanFilter를 사용하여, 필터링이 되지 않는 열에는 드롭다운이 보이지 않도록 설정하였습니다.
<ColumnFilter>
{header.column.getCanFilter() ? (
<select onChange={({ currentTarget: { value } }) => onFilterChange(value)}>
<option value='null'>All</option>
{sortedUniqueValues.map((value) => (
<option key={value}>{value}</option>
))}
</select>
) : null}
</ColumnFilter>
-
media queries를 사용하여 반응형 페이지를 구현하였습니다.
overflow: scroll
을 사용하여 스크롤기능으로 mobile, tablet, desktop 등 에서 사용가능한 반응형 페이지로 구현하였습니다.
MISSION 2
- 제시된 API는 총 100개의 배열로 데이터를 제공함으로써 많아야 이틀치 분량의 데이터만 제공해줍니다. 24시간을 온전히 가지고 있지 않는 경우도 있어서 따로 데이터 가공을 거쳤습니다.
const CSVdata: Array<Object | undefined[] | any> = [
['Channer'],
['Created at', weatherData?.channel.created_at],
['Description', weatherData?.channel.description],
['Latitude', weatherData?.channel.latitude],
['Longitude', weatherData?.channel.longitude],
['Name', weatherData?.channel.name],
['Updated at', weatherData?.channel.updated_at],
[''],
['Feeds'],
['Created at', 'Entry ID', 'Temp', 'Humidity', 'Pressure'],
...(weatherData?.feeds.map((i) => {
const { created_at, entry_id, field1, field2, field3 } = i;
const arrayData = [created_at, entry_id, field1, field2, field3];
return arrayData;
}) || []),
];
- 사용자의 편의성을 고려하여 +, - 버튼이 아닌 마우스 휠로 확대 축소가 가능하도록 구현
MISSION 3
- 날짜 선택 시 캘린더 UI 적용
- TypeScript 사용