Macro wasm_react::classnames
source · [−]macro_rules! classnames {
[@single $result:ident <<] => { ... };
[@single $result:ident << .$str:literal $( $tail:tt )*] => { ... };
[@single $result:ident << .$bool:ident $( $tail:tt )*] => { ... };
[@single $result:ident << .$block:block $( $tail:tt )*] => { ... };
[] => { ... };
[$( $tt:tt )*] => { ... };
}
Expand description
Constructs a String
based on various types that implement
Classnames
.
Example
assert_eq!(
classnames![."button"."blue"],
"button blue ".to_string(),
);
let blue = false;
let disabled = true;
assert_eq!(
classnames![."button".blue.disabled],
"button disabled ".to_string(),
);
let is_blue = Some("blue");
let disabled = "disabled".to_string();
assert_eq!(
classnames![."button".{is_blue}.{&disabled}],
"button blue disabled ",
);