Skip to main content

placeholder_html

Function placeholder_html 

Source
pub fn placeholder_html(
    state: Readiness,
    message: &str,
    action: Option<Markup<'_>>,
    opts: &Emit,
) -> String
Expand description

A region’s stand-in, or nothing at all when the region has its content.

use makeover_layout::Readiness;
use makeover_webview::{Emit, placeholder::placeholder_html};

let html = placeholder_html(Readiness::Empty, "No projects yet", None, &Emit::default());
assert!(html.contains(r#"data-state="empty""#));
assert!(html.contains("No projects yet"));

// The one state that draws its own content draws no stand-in.
assert!(placeholder_html(Readiness::Ready, "unused", None, &Emit::default()).is_empty());

role="status" rather than alert for everything but a failure, on the same reasoning Node::Notice uses: an empty list is not an interruption. A failure is, because the user is looking at a region that should have had something in it and nothing else on the page will say so.