/
RoundedSquare.tsx
62 lines (56 loc) · 2.18 KB
/
RoundedSquare.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
import React from 'react';
import { Icons } from '../../types';
import { ICONS_TO_SOURCE } from '../../constants/icons';
import CircleIcon from '../CircleIcon/CircleIcon';
import { CountCircle } from '../CircleIcon';
import { TYPE_TO_IMG_SRC, TYPE_TO_WALLET_COLOR } from './constants';
import { WALLET_SUBTYPES } from './constants';
export type RoundedSquareProps = {
title?: string;
description?: string;
type?: string;
iconSrc?: string;
imgSrc?: string;
count?: string | number;
onClick?: () => void;
bgColor?: string;
};
export const RoundedSquare: React.FC<RoundedSquareProps> = ({
title = 'Currencies',
description = 'Lorem ipsum sit dalor amet',
iconSrc = ICONS_TO_SOURCE[Icons.trophyIcon],
imgSrc,
type = WALLET_SUBTYPES.ACHIEVEMENTS,
count = '28',
onClick = () => {},
bgColor,
}) => {
const imgSource = imgSrc || TYPE_TO_IMG_SRC[type];
const backgroundColor = bgColor ?? `bg-${TYPE_TO_WALLET_COLOR[type]}`;
const circleClass = `flex w-full justify-end icon-display absolute right-[15px] bottom-[10px] max-h-[40px] max-w-[40px]`;
return (
<button
onClick={onClick}
className={`flex relative ${backgroundColor} py-[15px] px-[15px] w-[170px] h-[170px] rounded-[40px] rounded-square-card-container`}
>
<div className="w-full relative">
<section className="title-headline-container flex items-center justify-between">
<CountCircle
count={count}
className="solo-counter-circle right-[0px] top-[0px] relative"
/>
<h3 className="line-clamp-2 font-bold text-[13px] text-grayscale-900 text-left">
{title}
</h3>
</section>
<div className="graphic-background relative flex justify-center">
<img className="max-w-[130px]" src={imgSource} />
</div>
</div>
<div className={circleClass}>
<CircleIcon iconSrc={iconSrc} count={count} size="40" />
</div>
</button>
);
};
export default RoundedSquare;