update
This commit is contained in:
parent
b1c6ab8b7d
commit
f7668c5c54
3 changed files with 26 additions and 6 deletions
src/ui/primitives
|
@ -71,6 +71,16 @@ impl Render for DivWidget {
|
|||
}
|
||||
}
|
||||
|
||||
impl DivWidget {
|
||||
pub fn extended_class_(&self) -> Vec<String> {
|
||||
let mut c = self.base_class();
|
||||
for e in &self.0 {
|
||||
c.extend_from_slice(&e.extended_class());
|
||||
}
|
||||
c
|
||||
}
|
||||
}
|
||||
|
||||
impl UIWidget for DivWidget {
|
||||
fn can_inherit(&self) -> bool {
|
||||
false
|
||||
|
@ -81,11 +91,11 @@ impl UIWidget for DivWidget {
|
|||
}
|
||||
|
||||
fn extended_class(&self) -> Vec<String> {
|
||||
let mut c = self.base_class();
|
||||
for e in &self.0 {
|
||||
c.extend_from_slice(&e.extended_class());
|
||||
if self.1 {
|
||||
self.extended_class_()
|
||||
} else {
|
||||
vec![]
|
||||
}
|
||||
c
|
||||
}
|
||||
|
||||
fn render_with_class(&self, _: &str) -> Markup {
|
||||
|
@ -104,7 +114,11 @@ impl UIWidget for DivWidget {
|
|||
.collect::<Vec<_>>()
|
||||
.join(" ");
|
||||
|
||||
PreEscaped(format!("<div {attrs}> {} </a>", inner.0))
|
||||
PreEscaped(format!(
|
||||
"<div class='{}' {attrs}> {} </a>",
|
||||
self.extended_class_().join(" "),
|
||||
inner.0
|
||||
))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue