Skip to content

Instantly share code, notes, and snippets.

@rebo
Created June 4, 2020 13:24
Show Gist options
  • Save rebo/88c5a736af846a540606bdb8294d7de8 to your computer and use it in GitHub Desktop.
Save rebo/88c5a736af846a540606bdb8294d7de8 to your computer and use it in GitHub Desktop.
#[view_macro]
fn showcard_view<Ms: 'static>(
opts: ShowOpts,
root: Node<Ms>,
_children: Vec<Node<Ms>>,
mut title: Node<Ms>,
mut description: Node<Ms>,
award: Vec<(Node<Ms>, AwardOpts)>,
) -> Node<Ms> {
center![
root![
s().width(px(400))
.border_style_solid()
.border_color(seed_colors::Gray::No4)
.radius(px(6))
.border_width(px(1))
.padding_x(px(24))
.padding_y(px(12)),
as_tag![
h2,
title,
s().font_size(px(18)).font_weight_v500(),
],
as_tag![
p,
description,
s().font_size(px(18)).font_weight_v500(),
],
center![
s().padding_y(px(8)).font_weight_v900(),
"Votes ",
opts.votes
],
h3![
"Awards",
s().font_size(px(20)).font_weight_v500(),
],
award.iter().map(|(award,args)|{
div![
s().padding_y(px(4)),
award,
div![
s().font_style_italic(),
args.awarding_body.clone()
]
]
})
]
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment