update
This commit is contained in:
parent
79f08fd202
commit
11e1bd975f
4 changed files with 41 additions and 6 deletions
|
@ -12,6 +12,8 @@ pub trait ColorCircle {
|
|||
fn next(&self) -> Self;
|
||||
}
|
||||
|
||||
// todo : specific colors rgb
|
||||
|
||||
macro_rules! color_map {
|
||||
($name:ident, $id:literal) => {
|
||||
#[derive(Debug, Clone)]
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
use components::Shell;
|
||||
use maud::{Markup, PreEscaped, Render};
|
||||
use prelude::Text;
|
||||
|
||||
// UI
|
||||
|
||||
|
@ -133,6 +134,42 @@ impl UIWidget for PreEscaped<String> {
|
|||
}
|
||||
}
|
||||
|
||||
impl UIWidget for String {
|
||||
fn can_inherit(&self) -> bool {
|
||||
Text(&self).can_inherit()
|
||||
}
|
||||
|
||||
fn base_class(&self) -> Vec<String> {
|
||||
Text(&self).base_class()
|
||||
}
|
||||
|
||||
fn extended_class(&self) -> Vec<String> {
|
||||
Text(&self).extended_class()
|
||||
}
|
||||
|
||||
fn render_with_class(&self, class: &str) -> Markup {
|
||||
Text(&self).render_with_class(class)
|
||||
}
|
||||
}
|
||||
|
||||
impl UIWidget for &str {
|
||||
fn can_inherit(&self) -> bool {
|
||||
Text(&self).can_inherit()
|
||||
}
|
||||
|
||||
fn base_class(&self) -> Vec<String> {
|
||||
Text(&self).base_class()
|
||||
}
|
||||
|
||||
fn extended_class(&self) -> Vec<String> {
|
||||
Text(&self).extended_class()
|
||||
}
|
||||
|
||||
fn render_with_class(&self, class: &str) -> Markup {
|
||||
Text(&self).render_with_class(class)
|
||||
}
|
||||
}
|
||||
|
||||
/// Trait for an element which can add new `attrs`
|
||||
pub trait AttrExtendable {
|
||||
#[must_use]
|
||||
|
|
|
@ -116,12 +116,8 @@ impl UIWidget for DivWidget {
|
|||
}
|
||||
|
||||
fn extended_class(&self) -> Vec<String> {
|
||||
if self.1 {
|
||||
self.extended_class_()
|
||||
} else {
|
||||
vec![]
|
||||
}
|
||||
}
|
||||
|
||||
fn render_with_class(&self, class: &str) -> Markup {
|
||||
let inner = html! {
|
||||
|
|
|
@ -348,7 +348,7 @@ impl TextWidget {
|
|||
|
||||
#[must_use]
|
||||
pub fn title(mut self, title: &str) -> Self {
|
||||
self.title = Some(title.to_string());
|
||||
self.title = Some(title.replace('\'', "\\'"));
|
||||
self
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue