windjammer_ui/components/generated/
center.rs

1#![allow(clippy::all)]
2#![allow(noop_method_call)]
3#[derive(Debug, Clone, PartialEq, Eq, Hash, Default)]
4pub struct Center {
5    pub child: String,
6    pub width: String,
7    pub height: String,
8    pub class: String,
9}
10
11impl Center {
12    #[inline]
13    pub fn new(child: String) -> Center {
14        Center {
15            child,
16            width: "100%".to_string(),
17            height: "100%".to_string(),
18            class: String::new(),
19        }
20    }
21    #[inline]
22    pub fn width(mut self, width: String) -> Center {
23        self.width = width;
24        self
25    }
26    #[inline]
27    pub fn height(mut self, height: String) -> Center {
28        self.height = height;
29        self
30    }
31    #[inline]
32    pub fn class(mut self, class: String) -> Center {
33        self.class = class;
34        self
35    }
36    #[inline]
37    pub fn render(&self) -> String {
38        let mut html = String::new();
39        html.push_str("<div class=\"wj-center ");
40        html.push_str(&self.class.as_str());
41        html.push_str(
42            "\" style=\"display: flex; align-items: center; justify-content: center; width: ",
43        );
44        html.push_str(&self.width.as_str());
45        html.push_str("; height: ");
46        html.push_str(&self.height.as_str());
47        html.push_str(";\">");
48        html.push_str(&self.child.as_str());
49        html.push_str("</div>");
50        html
51    }
52}