-
-
Notifications
You must be signed in to change notification settings - Fork 20
Expand file tree
/
Copy pathCard.js
More file actions
129 lines (126 loc) · 3.08 KB
/
Card.js
File metadata and controls
129 lines (126 loc) · 3.08 KB
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
import Image from 'next/image';
import { FiThumbsUp } from 'react-icons/fi';
import { BiComment } from 'react-icons/bi';
import { Grid, Card, Typography } from '@mui/material';
import NotStarted from '/public/Idea-List/notStart.svg';
import InProgress from '/public/Idea-List/inProgress.svg';
import Complted from '/public/Idea-List/completed.svg';
import styles from '../../styles/idea.module.css';
const IdeaCard = ({ data, onClick }) => {
const get_status_style = (status) => {
const final_status = status || { label: 'Idea Submitted' };
switch (final_status.label) {
case 'Completed':
return {
image: Complted,
color: '#68FDC6',
};
case 'In Progress':
return {
image: InProgress,
color: '#FDC668',
};
case 'Idea Submitted':
default:
return {
image: NotStarted,
color: '#FD6868',
};
}
};
return (
<Card
className={styles.card}
variant='outlined'
onClick={() => onClick()}>
<Grid
container
columns={{ xs: 1 }}
className={'m-0 pt-12 px-8 h-72'}>
<Grid item xs={1} className={''}>
<Typography
variant='h5'
className={`${styles.title}`}
color='#00F2FE'>
{data.title}
</Typography>
</Grid>
<div className='mb-2'>
<Grid
item
xs={1}
className='flex flex-row gap-2 items-center'>
<Image
src={get_status_style(data?.status).image}
alt={`status ${data.status?.label}`}
/>
<Typography
variant={'body2'}
color={get_status_style(data?.status).color}
className={styles.cardStatus}>
{data?.status?.label.toUpperCase() ||
'IDEA SUBMITTED'}
</Typography>
</Grid>
</div>
<Grid item xs={1} className=''>
<div
className={`${styles.cardDescription} whitespace-pre-wrap `}>
{data.description}
</div>
</Grid>
<div className='flex py-2 pt-8 w-full'>
<div
className='flex-1'
style={{
position: 'relative',
top: 0,
left: 0,
}}>
{data.avatarUrl.map((value, index) => {
return (
<div
key={index}
className={
!data.avatarUrl.includes(undefined) &&
index === 1
? styles.cardParent
: null
}>
{value && (
<Image
key={value + index.toString()}
className={styles.cardAvatar}
height={50}
width={50}
layout={'fixed'}
src={data.avatarUrl[index]}
alt={'user avatar'}
aria-label='user avatar'
/>
)}
</div>
);
})}
</div>
<div className='flex justify-center items-center text-[#ffffff99]'>
<div className='flex px-4 justify-center items-center'>
<div className='pr-2'>
{' '}
<FiThumbsUp />
</div>
{data.like_count}
</div>
<div className='px-4 flex justify-center items-center'>
<div className='pr-2'>
<BiComment />
</div>
{data.comment_count}
</div>
</div>
</div>
</Grid>
</Card>
);
};
export default IdeaCard;