Skip to content

Instantly share code, notes, and snippets.

@Mr-Malomz
Created March 10, 2023 11:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Mr-Malomz/effdc3a87379a897c004075b896020f4 to your computer and use it in GitHub Desktop.
Save Mr-Malomz/effdc3a87379a897c004075b896020f4 to your computer and use it in GitHub Desktop.
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