11import React , { useEffect , useState } from "react" ;
2- import styled , { css } from "styled-components" ;
32import { responsiveSize } from "styles/responsiveSize" ;
4- import { landscapeStyle } from "styles/landscapeStyle" ;
53import Skeleton from "react-loading-skeleton" ;
64import { Button } from "@kleros/ui-components-library" ;
75import ArrowIcon from "svgs/icons/arrow.svg" ;
@@ -10,85 +8,7 @@ import { getIpfsUrl } from "utils/getIpfsUrl";
108import StatusBanner from "./StatusBanner" ;
119import { DEFAULT_LIST_LOGO } from "consts/index" ;
1210import TruncatedText from "../TruncatedText" ;
13-
14- const Container = styled . div < { isListView : boolean } > `
15- height: calc(100% - 45px);
16- display: flex;
17- flex-direction: column;
18- justify-content: center;
19- align-items: center;
20- gap: 8px;
21-
22- // css for isList view
23- ${ ( { isListView } ) =>
24- isListView &&
25- css `
26- width: 100%;
27- height: max-content;
28- display: grid;
29- grid-template-rows: repeat(3, min-content);
30- grid-template-columns: 21px max-content 1fr max-content;
31- column-gap: ${ responsiveSize ( 8 , 24 , 900 ) } ;
32- row-gap: 16px;
33- padding: 16px;
34- h3,
35- img {
36- grid-column: span 4;
37- }
38- ${ landscapeStyle (
39- ( ) => css `
40- height: 64px;
41- justify-content: space-between;
42- grid-template-rows: 1fr;
43- grid-template-columns: auto 1fr ${ responsiveSize ( 80 , 100 , 900 ) } ${ responsiveSize ( 100 , 150 , 900 ) } max-content;
44- padding: 0 32px;
45- img {
46- grid-column: 1;
47- }
48- h3 {
49- grid-column: 2;
50- }
51- `
52- ) }
53- ` }
54- ` ;
55-
56- const StyledLogo = styled . img < { isListView : boolean } > `
57- width: ${ ( { isListView } ) => ( isListView ? "40px" : "125px" ) } ;
58- height: ${ ( { isListView } ) => ( isListView ? "40px" : "125px" ) } ;
59- object-fit: contain;
60- margin-bottom: ${ ( { isListView } ) => ( isListView ? "0px" : "8px" ) } ;
61- ` ;
62-
63- const StyledLabel = styled . label `
64- color: ${ ( { theme } ) => theme . secondaryText } ;
65- ` ;
66-
67- const StyledButton = styled ( Button ) `
68- background-color: transparent;
69- padding: 0;
70- flex-direction: row-reverse;
71- gap: 8px;
72- .button-text {
73- color: ${ ( { theme } ) => theme . primaryBlue } ;
74- font-weight: 400;
75- }
76- .button-svg {
77- fill: ${ ( { theme } ) => theme . secondaryPurple } ;
78- }
79-
80- :focus,
81- :hover {
82- background-color: transparent;
83- }
84- ` ;
85-
86- const SkeletonLogo = styled ( Skeleton ) < { isListView : boolean } > `
87- width: ${ ( { isListView } ) => ( isListView ? "40px" : "125px" ) } ;
88- height: ${ ( { isListView } ) => ( isListView ? "40px" : "125px" ) } ;
89- border-radius: ${ ( { isListView } ) => ( isListView ? "24px" : "62.5px" ) } ;
90- margin-bottom: ${ ( { isListView } ) => ( isListView ? "0px" : "8px" ) } ;
91- ` ;
11+ import { cn } from "~src/utils" ;
9212
9313interface IListInfo {
9414 title ?: string ;
@@ -108,21 +28,51 @@ const ListInfo: React.FC<IListInfo> = ({ title, totalItems, logoURI, status, isL
10828 } , [ logoURI ] ) ;
10929
11030 return (
111- < Container { ...{ isListView } } >
112- { ! imageLoaded ? < SkeletonLogo isListView = { isListView } /> : null }
113- < StyledLogo
31+ < div
32+ className = { cn (
33+ "flex flex-col justify-center items-center gap-2 h-[calc(100%-45px)]" ,
34+ isListView && [
35+ "grid grid-cols-[21px_max.content_1fr_max-content] grid-rows-[repeat(3,min-content)] gap-y-4" ,
36+ "w-full h-max lg:h-16 p-4" ,
37+ "[&_h3]:col-span-4 [&_img]:col-span-4" ,
38+ "lg:justify-between lg:grid-rows-[1fr] lg:px-8" ,
39+ "lg:grid-cols-[auto_1fr_calc(80px+(100-80)*(min(max(100vw,900px),1250px)-900px)/(1250-900))_calc(100px+(150-100)*(min(max(100vw,900px),1250px)-900px)/(1250-900))_max-content]" ,
40+ "lg:[&_img]:col-span-1 lg:[&_h3]:col-span-2" ,
41+ ]
42+ ) }
43+ style = { { columnGap : isListView ? responsiveSize ( 8 , 24 , 900 ) : undefined } }
44+ >
45+ { ! imageLoaded ? (
46+ < Skeleton
47+ className = { cn ( isListView ? "mb-0" : "mb-2" ) }
48+ height = { isListView ? 40 : 125 }
49+ width = { isListView ? 40 : 125 }
50+ borderRadius = { isListView ? "24px" : "62.5px" }
51+ />
52+ ) : null }
53+ < img
54+ className = { cn ( "object-contain" , isListView ? "w-10 h-10 mb-0" : "w-[125px] h-[125px] mb-2" ) }
11455 src = { imageSrc }
11556 alt = "List Img"
116- isListView = { isListView }
11757 onLoad = { ( ) => setImageLoaded ( true ) }
11858 onError = { ( ) => setImageSrc ( getIpfsUrl ( DEFAULT_LIST_LOGO ) ) }
11959 style = { { display : imageLoaded ? "block" : "none" } }
12060 />
12161 < TruncatedText text = { title ?? "" } maxLength = { 100 } />
122- < StyledLabel > { totalItems } items</ StyledLabel >
62+ < label className = "text-klerosUIComponentsSecondaryText" > { totalItems } items</ label >
12363 { isListView && < StatusBanner { ...{ status, isListView } } /> }
124- { isListView && < StyledButton text = "Open" Icon = { ArrowIcon } /> }
125- </ Container >
64+ { isListView && (
65+ < Button
66+ className = { cn (
67+ "flex-row-reverse gap-2 p-0 bg-transparent" ,
68+ "focus:bg-transparent hover:bg-transparent" ,
69+ "[&_.button-text]:text-klerosUIComponentsPrimaryBlue [&_.button-text]:font-normal [&_.button-svg]:fill-klerosUIComponentsSecondaryPurple"
70+ ) }
71+ text = "Open"
72+ Icon = { ArrowIcon }
73+ />
74+ ) }
75+ </ div >
12676 ) ;
12777} ;
12878
0 commit comments