|
1 | | -import { Construction, Work } from '@mui/icons-material'; |
2 | | -import { Box, Card, CardContent, Chip, Link, Stack, Typography, useTheme } from '@mui/material'; |
3 | | -import { wbsPipe, wbsNamePipe, ProjectPreview } from 'shared'; |
4 | | -import { datePipe, fullNamePipe } from '../../../utils/pipes'; |
5 | | -import { routes } from '../../../utils/routes'; |
6 | | -import { Link as RouterLink } from 'react-router-dom'; |
| 1 | +import { alpha, Box, Card, CardContent, Chip, Stack, Typography, useTheme, useMediaQuery } from '@mui/material'; |
| 2 | +import { wbsNamePipe, ProjectPreview } from 'shared'; |
| 3 | +import { datePipe } from '../../../utils/pipes'; |
7 | 4 |
|
8 | 5 | interface ProjectCardProps { |
9 | 6 | project: ProjectPreview; |
10 | 7 | } |
11 | 8 |
|
12 | 9 | const FeaturedProjectsCard: React.FC<ProjectCardProps> = ({ project }) => { |
13 | 10 | const theme = useTheme(); |
| 11 | + const isMobilePortrait = useMediaQuery('(max-width:600px)'); |
| 12 | + |
14 | 13 | return ( |
15 | 14 | <Card |
16 | 15 | variant="outlined" |
17 | 16 | sx={{ |
18 | 17 | minWidth: 'fit-content', |
19 | 18 | minHeight: 'fit-content', |
20 | | - mr: 3, |
21 | | - background: theme.palette.background.default |
| 19 | + width: isMobilePortrait ? '100%' : 'auto', |
| 20 | + background: theme.palette.background.paper, |
| 21 | + borderRadius: 2 |
22 | 22 | }} |
23 | 23 | > |
24 | 24 | <CardContent sx={{ padding: 2 }}> |
25 | 25 | <Stack direction="row" justifyContent="space-between"> |
26 | 26 | <Box> |
27 | | - <Typography fontWeight={'regular'} variant="subtitle2" noWrap> |
28 | | - <Link color={'text.primary'} component={RouterLink} to={`${routes.PROJECTS}/${wbsPipe(project.wbsNum)}`}> |
29 | | - {wbsPipe(project.wbsNum)} - {wbsNamePipe(project)} |
30 | | - </Link> |
| 27 | + <Typography |
| 28 | + fontWeight={'regular'} |
| 29 | + variant="h5" |
| 30 | + sx={{ marginBottom: '0.3rem', fontSize: { xs: '1.15rem', sm: '1.5rem' } }} |
| 31 | + > |
| 32 | + {wbsNamePipe(project)} |
| 33 | + </Typography> |
| 34 | + <Typography fontWeight={'regular'} fontSize={{ xs: 14, sm: 16 }} noWrap> |
| 35 | + Budget: ${project.budget} |
31 | 36 | </Typography> |
32 | | - <Link component={RouterLink} to={`${routes.PROJECTS}/${wbsPipe(project.wbsNum)}`} noWrap> |
33 | | - <Typography fontWeight={'regular'} variant="h5"> |
34 | | - {wbsPipe(project.wbsNum)} - {project.name} |
35 | | - </Typography> |
36 | | - </Link> |
37 | | - <Typography fontWeight={'regular'} fontSize={20} variant="h6" noWrap> |
| 37 | + <Typography fontWeight={'regular'} fontSize={{ xs: 14, sm: 16 }} noWrap> |
38 | 38 | {datePipe(project.startDate) + ' ⟝ ' + project.duration + ' wks ⟞ ' + datePipe(project.endDate)} |
39 | 39 | </Typography> |
40 | 40 | </Box> |
41 | 41 | </Stack> |
42 | 42 | <Stack direction="row" sx={{ marginTop: 1 }}> |
43 | | - <Chip |
44 | | - sx={{ marginTop: 1, marginRight: 2 }} |
45 | | - icon={<Construction />} |
46 | | - label={fullNamePipe(project.lead)} |
47 | | - size="medium" |
48 | | - /> |
49 | | - <Chip sx={{ marginTop: 1 }} icon={<Work />} label={fullNamePipe(project.manager)} size="medium" /> |
| 43 | + {project.teams.map((team) => ( |
| 44 | + <Chip |
| 45 | + sx={{ |
| 46 | + marginTop: 1, |
| 47 | + marginRight: 2, |
| 48 | + bgcolor: alpha(theme.palette.primary.main, 0.45), |
| 49 | + color: theme.palette.primary.light |
| 50 | + }} |
| 51 | + label={team.teamName} |
| 52 | + size="medium" |
| 53 | + /> |
| 54 | + ))} |
50 | 55 | </Stack> |
51 | 56 | </CardContent> |
52 | 57 | </Card> |
|
0 commit comments