patternfly_yew/core/
inset.rs

1use crate::prelude::AsClasses;
2use std::fmt::Formatter;
3use yew::Classes;
4
5/// Definition for inset
6#[derive(Copy, Clone, Debug, Default, PartialEq, Eq)]
7pub enum Inset {
8    #[default]
9    None,
10    Small,
11    Medium,
12    Large,
13    XLarge,
14    XXLarge,
15}
16
17impl std::fmt::Display for Inset {
18    fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
19        match self {
20            Self::None => f.write_str("pf-m-inset-none"),
21            Self::Small => f.write_str("pf-m-inset-sm"),
22            Self::Medium => f.write_str("pf-m-inset-md"),
23            Self::Large => f.write_str("pf-m-inset-lg"),
24            Self::XLarge => f.write_str("pf-m-inset-xl"),
25            Self::XXLarge => f.write_str("pf-m-inset-2xl"),
26        }
27    }
28}
29
30impl AsClasses for Inset {
31    fn extend_classes(&self, classes: &mut Classes) {
32        // relies on the `Display` implementation above
33        classes.push(self.to_string())
34    }
35}