windjammer_ui/components/generated/
colorpicker.rs1#![allow(clippy::all)]
2#![allow(noop_method_call)]
3use super::traits::Renderable;
4
5#[derive(Debug, Clone, PartialEq, Eq, Hash, Default)]
6pub struct ColorPicker {
7 pub value: String,
8 pub label: String,
9}
10
11impl ColorPicker {
12 #[inline]
13 pub fn new() -> ColorPicker {
14 ColorPicker {
15 value: "#000000".to_string(),
16 label: "".to_string(),
17 }
18 }
19 #[inline]
20 pub fn value(mut self, value: String) -> ColorPicker {
21 self.value = value;
22 self
23 }
24 #[inline]
25 pub fn label(mut self, label: String) -> ColorPicker {
26 self.label = label;
27 self
28 }
29}
30
31impl Renderable for ColorPicker {
32 #[inline]
33 fn render(self) -> String {
34 let label_html = {
35 if self.label != "" {
36 format!("<label>{}</label>", self.label)
37 } else {
38 "".to_string()
39 }
40 };
41 format!(
42 "<div class='wj-color-picker'>
43 {}
44 <input type='color' value='{}' class='wj-color-input'>
45 <span class='wj-color-value'>{}</span>
46</div>",
47 label_html, self.value, self.value
48 )
49 }
50}