Skip to content

Commit

Permalink
Merge pull request #23 from BananasDev0/RD-67
Browse files Browse the repository at this point in the history
Submit function of tooltip and number of caracters
  • Loading branch information
edmdz authored Apr 1, 2024
2 parents e290800 + 6b05f58 commit 1bd8915
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/components/ItemCard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,14 @@ import Card from '@mui/material/Card';
import CardContent from '@mui/material/CardContent';
import CardMedia from '@mui/material/CardMedia';
import Typography from '@mui/material/Typography';
import { Box, CardActionArea } from '@mui/material';
import { Box, CardActionArea, Tooltip } from '@mui/material';

export const ItemCard = ({ item, columns, onClick }) => {


return (
<Card sx={{ margin: 2 }}>
<Tooltip title={item.name}>
<CardActionArea onClick={onClick} sx={{ width: '100%', display: 'flex', flexDirection: 'column', alignItems: 'center' }}>
{item.imageUrl && (
<CardMedia
Expand All @@ -32,12 +35,16 @@ export const ItemCard = ({ item, columns, onClick }) => {
</Typography>
)}
<Typography sx={{ fontSize: '12px', ...(column.valueStyle || {}) }}>
{item[column.field]}

{/*item[column.field]*/}
{column.field ==='dpi' ? item[column.field]: '' }
{column.field === 'name' ? (item[column.field].length > 20 ? item[column.field].slice(0, 20) + '...' : item[column.field] ) : ''}
</Typography>
</Box>
))}
</CardContent>
</CardActionArea>
</Tooltip>
</Card>
);
};

0 comments on commit 1bd8915

Please sign in to comment.