Created
March 10, 2023 11:04
-
-
Save Mr-Malomz/effdc3a87379a897c004075b896020f4 to your computer and use it in GitHub Desktop.
This file contains 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
use yew::prelude::*; | |
use crate::models::product::Flower; | |
#[derive(Properties, PartialEq)] | |
pub struct FlowerCardProp { | |
pub flower: Flower, | |
} | |
#[function_component(FlowerCard)] | |
pub fn flower_card(FlowerCardProp { flower }: &FlowerCardProp) -> Html { | |
let name = flower.parameters.name.value.clone(); | |
let image_url = flower.parameters.img.value[0].url.clone(); | |
let image_alt = flower.parameters.img.value[0].alt.clone(); | |
html! { | |
<div class="col-md-6 col-lg-4 col-xl-3 mb-5"> | |
<div class="card" style="width: 18rem;"> | |
<img src={image_url} class="card-img-top" alt={image_alt} /> | |
<div class="card-body"> | |
<h5 class="card-title">{name}</h5> | |
</div> | |
</div> | |
</div> | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment