diff --git a/01-frontend/src/components/Rating.tsx b/01-frontend/src/components/Rating.tsx new file mode 100644 index 0000000..3375529 --- /dev/null +++ b/01-frontend/src/components/Rating.tsx @@ -0,0 +1,8 @@ +type RatingType = { + id: string; + rating: number; + text: string; + date: string; +}; + +export default RatingType; \ No newline at end of file diff --git a/01-frontend/src/helper/RatingCard.tsx b/01-frontend/src/helper/RatingCard.tsx index cd0f8db..53a66ba 100644 --- a/01-frontend/src/helper/RatingCard.tsx +++ b/01-frontend/src/helper/RatingCard.tsx @@ -1,9 +1,27 @@ -import { Typography } from "@mui/material"; +import { Card, CardActionArea, CardContent, Paper, Rating, Typography } from "@mui/material"; +import RatingType from "../components/Rating"; + +export default function RatingCard(ratingType: RatingType) { + + const handleClick = () => { + console.log(`Clicked on rating with id: ${ratingType.id}`); + } -export default function RatingCard() { return ( - - Hier steht ein Rating - + + + + + + Rating vom: {ratingType.date} + + + + {ratingType.text} + + + + + ); } \ No newline at end of file diff --git a/01-frontend/src/helper/Ratings.tsx b/01-frontend/src/helper/Ratings.tsx index 82eb556..61ab41b 100644 --- a/01-frontend/src/helper/Ratings.tsx +++ b/01-frontend/src/helper/Ratings.tsx @@ -1,7 +1,30 @@ -import { Button, Divider, Rating, TextField, Typography } from "@mui/material"; +import { Box, Button, Divider, Rating, TextField, Typography } from "@mui/material"; import RatingCard from "./RatingCard"; +import RatingType from "../components/Rating"; export default function Ratings() { + + const ratings: RatingType[] = [ + { + id: "1", + rating: 4.5, + text: "Great product!", + date: "2023-10-01", + }, + { + id: "2", + rating: 3.0, + text: "Average quality.", + date: "2023-10-02", + }, + { + id: "3", + rating: 5.0, + text: "Excellent value for money!", + date: "2023-10-03", + }, + ]; + return ( <>
@@ -10,12 +33,13 @@ export default function Ratings() {
Rate this product: - +