Skip to content

Commit 2937578

Browse files
authored
Merge pull request #2 from oslabs-beta/victor/marketplaceCards
add marketplace card UI
2 parents 50bc94e + 917608e commit 2937578

File tree

4 files changed

+122
-0
lines changed

4 files changed

+122
-0
lines changed
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
import {
2+
Avatar,
3+
Card,
4+
CardActions,
5+
CardContent,
6+
CardHeader,
7+
CardMedia,
8+
Collapse,
9+
IconButton,
10+
Menu,
11+
MenuItem,
12+
Typography,
13+
styled
14+
} from '@mui/material';
15+
16+
import { MoreVert } from '@mui/icons-material';
17+
import React from 'react';
18+
import imageSrc from '../../../../resources/marketplace_images/marketplace_image.png';
19+
import { red } from '@mui/material/colors';
20+
21+
const ITEM_HEIGHT = 48;
22+
const MarketplaceCard = () => {
23+
const [anchorEl, setAnchorEl] = React.useState<null | HTMLElement>(null);
24+
const open = Boolean(anchorEl);
25+
const handleClick = (event: React.MouseEvent<HTMLElement>) => {
26+
setAnchorEl(event.currentTarget);
27+
};
28+
const handleClose = () => {
29+
setAnchorEl(null);
30+
};
31+
return (
32+
<>
33+
<Card
34+
sx={{ maxWidth: 384, backgroundColor: '#1E1E1E', borderRadius: '12px' }}
35+
>
36+
<CardMedia
37+
sx={{ borderRadius: '12px', height: 200 }}
38+
component="img"
39+
height="194"
40+
image={imageSrc}
41+
alt="component buttons"
42+
/>
43+
<CardHeader
44+
avatar={
45+
<Avatar sx={{ bgcolor: red[500] }} aria-label="recipe">
46+
R
47+
</Avatar>
48+
}
49+
action={
50+
<IconButton
51+
aria-label="more"
52+
id="long-button"
53+
aria-controls={open ? 'long-menu' : undefined}
54+
aria-expanded={open ? 'true' : undefined}
55+
aria-haspopup="true"
56+
onClick={handleClick}
57+
>
58+
<MoreVert />
59+
</IconButton>
60+
}
61+
title="Gradient Buttons"
62+
subheader="Liam Rohn"
63+
/>
64+
<Menu
65+
id="long-menu"
66+
MenuListProps={{
67+
'aria-labelledby': 'long-button'
68+
}}
69+
anchorEl={anchorEl}
70+
open={open}
71+
onClose={handleClose}
72+
PaperProps={{
73+
style: {
74+
maxHeight: ITEM_HEIGHT * 4.5,
75+
width: '20ch',
76+
backgroundColor: '#1E1E1E'
77+
}
78+
}}
79+
>
80+
<MenuItem
81+
onClick={handleClose}
82+
sx={{
83+
color: '#C6C6C6'
84+
}}
85+
>
86+
Clone
87+
</MenuItem>
88+
</Menu>
89+
</Card>
90+
</>
91+
);
92+
};
93+
94+
export default MarketplaceCard;
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import { Container, Grid } from '@mui/material';
2+
3+
import MarketplaceCard from './MarketplaceCard';
4+
import React from 'react';
5+
6+
const MarketplaceCardContainer = () => {
7+
const numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9];
8+
return (
9+
<>
10+
<Container>
11+
<Grid
12+
container
13+
maxWidth={'1260px'}
14+
spacing={{ xs: 2, md: 3 }}
15+
columns={{ xs: 4, sm: 8, md: 12 }}
16+
>
17+
{numbers.map((num) => (
18+
<Grid item xs={4} sm={4} md={4} key={num}>
19+
<MarketplaceCard />
20+
</Grid>
21+
))}
22+
</Grid>
23+
</Container>
24+
</>
25+
);
26+
};
27+
28+
export default MarketplaceCardContainer;
Loading
Loading

0 commit comments

Comments
 (0)