✨ sloppy blog impl from example
This commit is contained in:
37
src/pages/blog/authors.rs
Normal file
37
src/pages/blog/authors.rs
Normal file
@@ -0,0 +1,37 @@
|
||||
use yew::prelude::*;
|
||||
|
||||
use crate::pages::blog::content::AuthorCard;
|
||||
|
||||
pub enum Msg {
|
||||
NextAuthors,
|
||||
}
|
||||
|
||||
pub struct Authors {
|
||||
seeds: Vec<u64>,
|
||||
}
|
||||
impl Component for Authors {
|
||||
type Message = Msg;
|
||||
type Properties = ();
|
||||
|
||||
fn create(_ctx: &Context<Self>) -> Self {
|
||||
Self { seeds: vec![1], }
|
||||
}
|
||||
|
||||
fn update(&mut self, _ctx: &Context<Self>, msg: Self::Message) -> bool {
|
||||
match msg { Msg::NextAuthors => { self.seeds = vec![1]; true } }
|
||||
}
|
||||
|
||||
fn view(&self, ctx: &Context<Self>) -> Html {
|
||||
html! {
|
||||
<div class="container section tile is-ancestor">
|
||||
{ for self.seeds.iter().map(|&seed| { html! {
|
||||
<div class="tile is-parent">
|
||||
<div class="tile is-child">
|
||||
<AuthorCard {seed} />
|
||||
</div>
|
||||
</div>
|
||||
} }) }
|
||||
</div>
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user