import { Dispatch, FunctionComponent, SetStateAction, useEffect } from "react"; import { ChainItemType, DisabledChainItemType } from "../../types"; import color from "../../styles/color"; import styled from "styled-components"; import { ChainItem } from "./chain-item"; interface Props { chainList: ChainItemType[]; disabledChainList: DisabledChainItemType[]; checkedItems: Set; setCheckedItems: Dispatch>>; } export const ChainList: FunctionComponent = (props) => { const { chainList, disabledChainList, checkedItems, setCheckedItems } = props; const checkedItemHandler = (chainItem: ChainItemType, isChecked: boolean) => { const tempSet = new Set(checkedItems); if (isChecked) { tempSet.add(chainItem); } else if (!isChecked && checkedItems.has(chainItem)) { tempSet.delete(chainItem); } setCheckedItems(tempSet); }; return ( {chainList.map((chainItem) => ( ))} {disabledChainList.map((chainItem) => ( ))} ); }; export const ChainContainer = styled.div` display: flex; flex-direction: column; width: 100%; //max-height: 33rem; overflow: scroll; flex: 1; background-color: ${(props) => props.color}; `;