11import React from "react" ;
2- import { Button , Card } from "@kleros/ui-components-library" ;
32import styled from "styled-components" ;
43import { responsiveSize } from "styles/responsiveSize" ;
4+ import { useToggle } from "react-use" ;
5+ import { Button , Card } from "@kleros/ui-components-library" ;
56import { getChainIcon , getChainName } from "components/ChainIcon" ;
67import { getStatusColor , getStatusLabel } from "components/RegistryCard/StatusBanner" ;
78import AliasDisplay from "components/RegistryInfo/AliasDisplay" ;
89import { Policies } from "./Policies" ;
910import EtherscanIcon from "svgs/icons/etherscan.svg" ;
1011import { Status } from "consts/status" ;
12+ import RemoveModal from "../Modal/RemoveModal" ;
1113
1214const StyledCard = styled ( Card ) `
1315 display: flex;
@@ -118,7 +120,7 @@ interface IInformationCard {
118120 chainId : number ;
119121 status : string ;
120122 isItem ?: boolean ;
121- // itemParams?: Object : item will haev dynamic params
123+ // itemParams?: Object : item will have dynamic params
122124}
123125
124126const InformationCard : React . FC < IInformationCard > = ( {
@@ -129,34 +131,45 @@ const InformationCard: React.FC<IInformationCard> = ({
129131 status = Status . Included ,
130132 isItem = false ,
131133} ) => {
134+ const [ isRemoveListModalOpen , toggleRemoveListModal ] = useToggle ( false ) ;
135+ const [ isRemoveItemModalOpen , toggleRemoveItemModal ] = useToggle ( false ) ;
136+
132137 return (
133- < StyledCard >
134- < TopInfo >
135- < TopLeftInfo >
136- < LogoAndTitle >
137- { ! isItem && < StyledLogo src = { logoURI } alt = "List Img" isList = { false } /> }
138- < h1 > { title } </ h1 >
139- </ LogoAndTitle >
140- < StyledP > { description } </ StyledP >
141- </ TopLeftInfo >
142- < TopRightInfo >
143- < ChainContainer >
144- < p > { getChainIcon ( chainId ) } </ p >
145- < p > { getChainName ( chainId ) } </ p >
146- </ ChainContainer >
147- < StyledEtherscanIcon />
148- < StatusContainer { ...{ status, isList : false } } >
149- < label className = "front-color dot" > { getStatusLabel ( status ) } </ label >
150- </ StatusContainer >
151- </ TopRightInfo >
152- </ TopInfo >
153- < Divider />
154- < BottomInfo >
155- < AliasDisplay address = "0x95222290DD7278Aa3Ddd389Cc1E1d165CC4BAfe5" />
156- < Button variant = "secondary" text = { isItem ? "Remove Item" : "Remove List" } />
157- </ BottomInfo >
158- < Policies />
159- </ StyledCard >
138+ < >
139+ < StyledCard >
140+ < TopInfo >
141+ < TopLeftInfo >
142+ < LogoAndTitle >
143+ { ! isItem && < StyledLogo src = { logoURI } alt = "List Img" isList = { false } /> }
144+ < h1 > { title } </ h1 >
145+ </ LogoAndTitle >
146+ < StyledP > { description } </ StyledP >
147+ </ TopLeftInfo >
148+ < TopRightInfo >
149+ < ChainContainer >
150+ < p > { getChainIcon ( chainId ) } </ p >
151+ < p > { getChainName ( chainId ) } </ p >
152+ </ ChainContainer >
153+ < StyledEtherscanIcon />
154+ < StatusContainer { ...{ status, isList : false } } >
155+ < label className = "front-color dot" > { getStatusLabel ( status ) } </ label >
156+ </ StatusContainer >
157+ </ TopRightInfo >
158+ </ TopInfo >
159+ < Divider />
160+ < BottomInfo >
161+ < AliasDisplay address = "0x95222290DD7278Aa3Ddd389Cc1E1d165CC4BAfe5" />
162+ < Button
163+ variant = "secondary"
164+ text = { isItem ? "Remove Item" : "Remove List" }
165+ onClick = { isItem ? toggleRemoveItemModal : toggleRemoveListModal }
166+ />
167+ </ BottomInfo >
168+ < Policies />
169+ </ StyledCard >
170+ { isRemoveItemModalOpen ? < RemoveModal isItem = { isItem } toggleModal = { toggleRemoveItemModal } /> : null }
171+ { isRemoveListModalOpen ? < RemoveModal isItem = { isItem } toggleModal = { toggleRemoveListModal } /> : null }
172+ </ >
160173 ) ;
161174} ;
162175export default InformationCard ;
0 commit comments