icns-frontend/components/chain-list/all-chains-item.tsx

63 lines
1.6 KiB
TypeScript
Raw Normal View History

import { ChainItemType } from "../../types";
2022-12-15 10:06:44 +00:00
import { Dispatch, FunctionComponent, SetStateAction } from "react";
import { ChainImage } from "./chain-image";
import { Flex1 } from "../../styles/flex-1";
import {
2022-12-15 10:06:44 +00:00
ChainCheckBox,
ChainImageContainer,
ChainInfoContainer,
ChainItemContainer,
2022-12-15 10:06:44 +00:00
ChainName,
WalletAddress,
} from "./chain-item";
import color from "../../styles/color";
import styled from "styled-components";
interface Props {
allChecked: boolean;
setAllChecked: Dispatch<SetStateAction<boolean>>;
chainItem: ChainItemType;
}
export const AllChainsItem: FunctionComponent<Props> = (props) => {
const { allChecked, setAllChecked, chainItem } = props;
const checkHandler = () => {
setAllChecked(!allChecked);
};
return (
<AllChainsContainer>
<ChainItemContainer
key={chainItem.prefix}
isLoading={false}
2022-12-15 15:43:18 +00:00
checked={allChecked}
onClick={checkHandler}
>
<ChainImageContainer width="3rem" height="3rem">
<ChainImage
src={chainItem.chainImageUrl}
fill={true}
alt={`${chainItem.prefix} chain image`}
/>
</ChainImageContainer>
<ChainInfoContainer>
<ChainName>{`.${chainItem.prefix}`}</ChainName>
<WalletAddress>{chainItem.address}</WalletAddress>
</ChainInfoContainer>
<Flex1 />
2022-12-13 14:46:32 +00:00
<ChainCheckBox checked={allChecked} readOnly />
</ChainItemContainer>
</AllChainsContainer>
);
};
const AllChainsContainer = styled.div`
width: 100%;
2022-12-15 15:43:18 +00:00
background-color: ${color.grey["900"]};
`;