[][src]Function sauron::html::attributes::styles_flag

pub fn styles_flag<V, MSG, P>(
    trio: P
) -> Attribute<&'static str, &'static str, AttributeValue, Event, MSG> where
    P: AsRef<[(&'static str, V, bool)]>,
    V: Into<Value> + Clone

A helper function which creates a style attribute by assembling only the parts that passed the boolean flag

   styles_flag([
       ("display", "block", self.is_active),
       ("display", "none", !self.is_active),
   ]),

This could also be written as

    styles([("display", if self.is_active { "block" }else{ "none" })])