This repository has been archived on 2026-01-31. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
nextjs-serve-actions/app/components/Dashboard/ItemDialog/ItemData.tsx
2024-05-23 16:55:29 +02:00

40 lines
1.1 KiB
TypeScript

import { Card, Typography } from '@mui/material';
import { Box } from '@mui/system';
import { Item, ItemComment } from '../../../../data/types';
interface ItemDataProps {
item: Item;
comments: ItemComment[];
}
export default function ItemData({ item, comments }: ItemDataProps) {
return (
<Box>
<Typography>Description: {item.description}</Typography>
<Typography>
Price: {Number(item.price).toFixed(2)} {item.currency}
</Typography>
<Box
sx={{
height: 250,
overflowY: 'auto'
}}
>
{comments &&
comments.map((comment) => (
<Card key={comment.id} sx={{ margin: '5px', padding: '10px' }}>
<Typography>Comment: {comment.body}</Typography>
<Typography>Score: {comment.score}</Typography>
<Typography>Regret: {comment.regret ? 'Yes' : 'No'}</Typography>
<Typography>
Created:{' '}
{comment.createdAt &&
new Date(comment.createdAt).toLocaleString()}
</Typography>
</Card>
))}
</Box>
</Box>
);
}