card
look
A card with a title, a line and its actions.
Drawn
Ship the 0.4 notes? needs you
asked 12 minutes ago · release
The sample
fn holders() -> Vec<Block> {
let screen = Screen::new().id("today").title("Today").blocks(vec![
text("today-hint", "3 builds ran, 1 needs you."),
marked("today-deploy", "Deploy", "waiting on review", "", Tone::Needs),
]);
let sheet = Sheet::new(
"Add a check",
vec![
text("add-note", "Pick what runs on each push."),
b!(Chips(
Chips::new("runs", vec![chip("lint"), chip("test"), chip("bench")])
.id("add-runs")
.multi(true)
.selected(vec!["lint".to_string(), "test".to_string()])
)),
button("add-check", "add", ButtonStyle::Primary),
],
)
.id("add");
let card = Card::new()
.id("ship-notes")
.kind(CardKind::Ask)
.title("Ship the 0.4 notes?")
.subtitle("asked 12 minutes ago · release")
.badge(Label {
text: "needs you".into(),
tone: Some(Tone::Needs),
})
.buttons(vec![
button("ship", "ship", ButtonStyle::Primary),
button("hold", "hold", ButtonStyle::Plain),
button("discard", "discard", ButtonStyle::Destructive),
]);
vec![
b!(Screen(screen)),
section(
"due",
"Due soon · 2",
vec![
b!(Row(row("due-cert", "Renew the cert", "expires Friday", "3d"))),
b!(Row(row("due-keys", "Rotate keys", "monthly", "5d"))),
],
),
b!(Sheet(sheet)),
b!(Card(card)),
]
}{
"blocks": [
{
"badge": {
"text": "needs you",
"tone": "needs"
},
"buttons": [
{
"action": "ship",
"fallback": {
"title": "ship"
},
"id": "ship",
"label": "ship",
"style": "primary",
"type": "button"
},
{
"action": "hold",
"fallback": {
"title": "hold"
},
"id": "hold",
"label": "hold",
"style": "plain",
"type": "button"
},
{
"action": "discard",
"fallback": {
"title": "discard"
},
"id": "discard",
"label": "discard",
"style": "destructive",
"type": "button"
}
],
"fallback": {
"subtitle": "asked 12 minutes ago · release",
"title": "Ship the 0.4 notes?"
},
"id": "ship-notes",
"kind": "ask",
"subtitle": "asked 12 minutes ago · release",
"title": "Ship the 0.4 notes?",
"type": "card"
}
],
"fallback": {
"title": "screen"
},
"id": "card",
"type": "screen"
}Its fallback
What a renderer without
card draws: a row from the fallback the block carries.Ship the 0.4 notes?asked 12 minutes ago · release
Style hooks
.b-cardthe block
[data-block=card]every block of the kind
[data-id=ship-notes]this one block
Every page here is a blocks
Screen, written by site::page: no hand-written HTML. Source: https://github.com/jirathip-dev/blocks