screen
look
A whole screen: its title and its blocks.
Drawn
today
3 builds ran, 1 needs you.
!Deploywaiting on review
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": [
{
"blocks": [
{
"id": "today-hint",
"markdown": "3 builds ran, 1 needs you.",
"type": "text"
},
{
"figure": {
"state": "needs"
},
"id": "today-deploy",
"subtitle": "waiting on review",
"title": "Deploy",
"type": "row"
}
],
"fallback": {
"title": "Today"
},
"id": "today",
"title": "Today",
"type": "screen"
}
],
"fallback": {
"title": "screen"
},
"id": "screen",
"type": "screen"
}Its fallback
What a renderer without
screen draws: a row from the fallback the block carries.Today
Style hooks
.b-screenthe block
[data-block=screen]every block of the kind
[data-id=today]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