Skip to content

Commit e59bacf

Browse files
feat: added catalog card and icons fix 2
Signed-off-by: rishabhsharma1997 <[email protected]>
1 parent 2b40a2c commit e59bacf

File tree

2 files changed

+21
-42
lines changed

2 files changed

+21
-42
lines changed

src/custom/CatalogCard/CatalogCard.tsx

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import {
1717
DesignInnerCard,
1818
DesignName,
1919
DesignType,
20+
ImageWrapper,
2021
MetricsContainerFront,
2122
MetricsCount,
2223
MetricsDiv,
@@ -32,7 +33,7 @@ type CatalogCardProps = {
3233
// eslint-disable-next-line @typescript-eslint/no-explicit-any
3334
pattern: any;
3435
patternType: string;
35-
url: string;
36+
cardLink: string;
3637
cardHeight: string;
3738
cardWidth: string;
3839
cardStyles: React.CSSProperties;
@@ -62,15 +63,15 @@ const CatalogCard: React.FC<CatalogCardProps> = ({
6263
cardHeight,
6364
cardWidth,
6465
cardStyles,
65-
url
66+
cardLink
6667
}) => {
6768
const outerStyles = {
6869
height: cardHeight,
6970
width: cardWidth,
7071
...cardStyles
7172
};
7273
return (
73-
<DesignCardUrl href={url} target="_blank" rel="noreferrer">
74+
<DesignCardUrl href={cardLink} target="_blank" rel="noreferrer">
7475
<DesignCard outerStyles={outerStyles}>
7576
<DesignInnerCard className="innerCard">
7677
<ClassWrap catalogClassName={pattern?.catalog_data?.content_class} />
@@ -84,19 +85,9 @@ const CatalogCard: React.FC<CatalogCardProps> = ({
8485
>
8586
{pattern.name}
8687
</DesignName>
87-
<div
88-
style={{
89-
background: 'rgba(231, 239, 243, 0.40)',
90-
display: 'flex',
91-
alignItems: 'center',
92-
justifyContent: 'center',
93-
padding: '0.5rem',
94-
width: '100%',
95-
borderRadius: '0.5rem'
96-
}}
97-
>
88+
<ImageWrapper>
9889
<DesignIcon height={'118'} width={'120'} />
99-
</div>
90+
</ImageWrapper>
10091
</DesignDetailsDiv>
10192
<MetricsContainerFront>
10293
<MetricsDiv>

src/custom/CatalogCard/style.tsx

Lines changed: 15 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,12 @@ export const StyledClassWrapper = styled('div')(() => ({
1616
}));
1717

1818
export const StyledInnerClassWrapper = styled('div')<StyledInnerClassWrapperProps>(({
19-
catalogClassName,
20-
theme
19+
catalogClassName
2120
}) => {
2221
const mapToColor: Record<string, string> = {
23-
community: theme.palette.icon.secondary,
24-
official: theme.palette.background.cta?.default || '#EBC017',
25-
verified: theme.palette.background.brand?.default || ''
22+
community: 'rgba(122,132,142,.8)',
23+
official: '#EBC017',
24+
verified: '#00B39F'
2625
};
2726
return {
2827
font: 'bold 10px sans-serif',
@@ -67,10 +66,7 @@ export const DesignInnerCard = styled('div')(({ theme }) => ({
6766
height: '100%',
6867
textAlign: 'center',
6968
transition: 'transform 0.6s',
70-
boxShadow:
71-
theme.palette.mode === 'dark'
72-
? '0 4px 8px 0 rgba(255, 255, 255, 0.1)'
73-
: '0 4px 8px 0 rgba(0,0,0,0.2)',
69+
boxShadow: `2px 2px 3px 0px ${theme.palette.background.brand?.default}`,
7470
borderRadius: '0.9375rem'
7571
}));
7672
export const DesignType = styled('span')(({ theme }) => ({
@@ -105,17 +101,8 @@ export const DesignName = styled(Typography)(({ theme }) => ({
105101
overflow: 'hidden',
106102
whiteSpace: 'nowrap',
107103
textOverflow: 'ellipsis',
108-
// textAlign: "center",
109-
textAlign: 'left',
110-
'& :after': {
111-
content: "''",
112-
textAlign: 'right',
113-
position: 'absolute',
114-
bottom: '0',
115-
right: '0',
116-
width: '70%',
117-
background: 'linear-gradient(to right, rgba(255, 255, 255, 0), rgba(255, 255, 255, 1) 50%)'
118-
}
104+
textAlign: 'center',
105+
width: '100%'
119106
}));
120107
export const MetricsContainerFront = styled('div')(({ theme }) => ({
121108
display: 'flex',
@@ -153,12 +140,13 @@ export const DesignDetailsDiv = styled('div')(() => ({
153140
height: 'max-content'
154141
}
155142
}));
156-
export const CardFront = styled('div')(({ theme }) => ({
157-
boxShadow: `2px 2px 3px 0px ${theme.palette.background.brand?.default}`,
158-
background: `linear-gradient(to left bottom, #EBEFF1,#f4f5f7, #f7f7f9, #fff, #fff, #fff,#fff,#fff, #fff, #f7f7f9, #f4f5f7, #EBEFF1)`,
143+
144+
export const ImageWrapper = styled('div')(({ theme }) => ({
145+
background: theme.palette.mode === 'light' ? 'rgba(231, 239, 243, 0.40)' : '#212121',
146+
display: 'flex',
147+
alignItems: 'center',
148+
justifyContent: 'center',
149+
padding: '0.5rem',
159150
width: '100%',
160-
height: '100%',
161-
WebkitBackfaceVisibility: 'hidden',
162-
borderRadius: '0.9375rem',
163-
backfaceVisibility: 'hidden'
151+
borderRadius: '0.5rem'
164152
}));

0 commit comments

Comments
 (0)