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