import { ChainItemType } from "../../types"; import { ChangeEvent, FunctionComponent, useState } from "react"; import { ChainImageContainer, ChainInfoContainer, ChainItemContainer, } from "./chain-list"; import color from "../../styles/color"; import { Flex1 } from "../../styles/flex-1"; import styled from "styled-components"; import { ChainImage } from "./chain-image"; interface Props { chainItem: ChainItemType; checkedItemHandler: (chainItem: ChainItemType, isChecked: boolean) => void; } export const ChainItem: FunctionComponent = (props) => { const { chainItem, checkedItemHandler } = props; const [checked, setChecked] = useState(false); const checkHandler = (event: ChangeEvent) => { setChecked(!checked); checkedItemHandler(chainItem, event.target.checked); }; return ( {`.${chainItem.prefix}`} {chainItem.address} checkHandler(event)} /> ); }; const ChainName = styled.div` font-weight: 600; font-size: 0.8rem; line-height: 1rem; color: ${color.grey["100"]}; `; const WalletAddress = styled.div` font-weight: 500; font-size: 0.8rem; line-height: 1rem; color: ${color.grey["400"]}; `; const ChainCheckBox = styled.input.attrs({ type: "checkbox" })` width: 1.5rem; height: 1.5rem; `;