Created
October 14, 2023 20:34
-
-
Save theilgaz/350c25641eccbf8cf0f245d82cf22a53 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { useState } from "react" | |
export interface NescafeXpressProps { | |
type: "Americano" | "Original" | "Latte" | "Black Roast" | "Vanilla" | "Caramel" | "Cafe Choco" | |
image: string | |
rating: string | |
} | |
export function NescafeXpressCard({ type, image, rating }: NescafeXpressProps) { | |
return ( | |
<div className="bg-white flex flex-col items-center justify-center space-y-2 shadow-md rounded-md p-4"> | |
<div className="flex flex-col items-center justify-center space-y-2"> | |
<img src={image} className="w-32 h-32 rounded-full" /> | |
<h1 className="text-xl font-semibold text-gray-800">{type}</h1> | |
<div className="flex items-center justify-center space-x-2"> | |
<div className="flex items-center justify-center space-x-2"> | |
<h1 className="text-lg font-semibold text-gray-800">{rating}</h1> | |
</div> | |
</div> | |
</div> | |
</div> | |
) | |
} | |
export function NescafeXpressList() { | |
const imageUrl = "https://www.nescafe.com/tr/sites/default/files/styles/product_list_large/public/2021-10/" | |
const [items, setItems] = useState<NescafeXpressProps[]>([ | |
{ | |
type: "Americano", | |
image: `${imageUrl}nescafe-xpress-americano.png`, | |
rating: "⭐⭐⭐⭐⭐", | |
}, | |
{ | |
type: "Original", | |
image: `${imageUrl}nescafe-xpress-original_0.png`, | |
rating: "⭐⭐⭐⭐⭐", | |
}, | |
{ | |
type: "Latte", | |
image: `${imageUrl}nescafe-xpress-cafelatte.png`, | |
rating: "⭐⭐⭐⭐⭐", | |
}, | |
{ | |
type: "Black Roast", | |
image: `${imageUrl}nescafe-xpress-blackroast.png`, | |
rating: "⭐⭐⭐⭐⭐", | |
}, | |
{ | |
type: "Vanilla", | |
image: `${imageUrl}nescafe-xpress-vanilla_0.png`, | |
rating: "⭐⭐⭐⭐⭐", | |
}, | |
{ | |
type: "Caramel", | |
image: `${imageUrl}nescafe-xpress-caramel.png`, | |
rating: "⭐⭐⭐⭐⭐", | |
}, | |
{ | |
type: "Cafe Choco", | |
image: `${imageUrl}nescafe-xpress-cafechoco.png`, | |
rating: "⭐⭐⭐⭐⭐", | |
}, | |
]) | |
return ( | |
<div className="grid grid-cols-1 gap-4 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 p-4"> | |
{items.map((item, index) => ( | |
<NescafeXpressCard key={index} {...item} /> | |
))} | |
</div> | |
) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment