Add validation styling

This commit is contained in:
Thomas Gideon 2020-06-19 16:35:43 -04:00
parent 1c03cdb809
commit bfa2f0a64a
4 changed files with 22 additions and 5 deletions

View file

@ -124,6 +124,14 @@ pub fn render_on_change<P: Properties + PartialEq>(
}
}
pub fn valid_as_class(v: &Option<bool>) -> &'static str {
match v {
None => "",
Some(true) => " is-valid",
Some(false) => " is-invalid",
}
}
pub fn collect_bs<'a, T>(t: &'a Option<T>, ts: &'a [T]) -> Vec<&'a T> {
if let Some(t) = t.as_ref() {
let mut r = vec![t];