source: components/BuildCard.tsx@ e599341

main
Last change on this file since e599341 was e599341, checked in by Mihail <mihail2.naumov@…>, 7 months ago

Added frontend elements

  • Property mode set to 100644
File size: 2.1 KB
RevLine 
[1bf6e1f]1import React from 'react';
2import { Card, CardMedia, CardContent, Typography, Box, Chip } from '@mui/material';
3import StarIcon from '@mui/icons-material/Star';
[e599341]4// import PersonIcon from '@mui/icons-material/Person';
[1bf6e1f]5
6export default function BuildCard({ build, onClick }: { build: any, onClick: () => void }) {
[e599341]7 const formattedPrice = new Intl.NumberFormat('en-US', { style: 'currency', currency: 'EUR' }).format(build.total_price || 0);
[1bf6e1f]8
9 return (
10 <Card
11 sx={{ height: '100%', display: 'flex', flexDirection: 'column', cursor: 'pointer', transition: 'all 0.2s', '&:hover': { transform: 'translateY(-4px)', boxShadow: 6 } }}
12 onClick={onClick}
13 >
14 <CardMedia
15 component="img"
16 height="160"
17 image={build.img_url || "https://placehold.co/600x400?text=PC+Build"}
18 alt={build.name}
19 />
20 <CardContent sx={{ flexGrow: 1, pb: 1 }}>
21 <Typography gutterBottom variant="h6" noWrap title={build.name}>
22 {build.name}
23 </Typography>
24
25 {/*Ne se renderira user-ot*/}
26 <Box sx={{ display: 'flex', alignItems: 'center', mb: 1, color: 'text.secondary' }}>
[e599341]27 {/* <PersonIcon sx={{ fontSize: 16, mr: 0.5 }} />*/}
28 {/* <Typography variant="caption">{build.user || 'Unknown'}</Typography>*/}
[1bf6e1f]29 </Box>
30
31 <Box sx={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', mt: 'auto' }}>
32 <Chip label={formattedPrice} size="small" color="primary" variant="outlined" />
33 <Box sx={{ display: 'flex', alignItems: 'center' }}>
34 <StarIcon fontSize="small" sx={{ color: '#faaf00', mr: 0.5 }} />
35 <Typography variant="body2" fontWeight="bold">
[e599341]36 {Number(build.avgRating || 5).toFixed(1)}
[1bf6e1f]37 </Typography>
38 </Box>
39 </Box>
40 </CardContent>
41 </Card>
42 );
[e599341]43}
Note: See TracBrowser for help on using the repository browser.