diff options
author | 2019-12-16 11:09:02 +0100 | |
---|---|---|
committer | 2019-12-18 11:30:51 +0100 | |
commit | 95988e8e251d5e416698d3883f85a469daed6365 (patch) | |
tree | ad267b855f2c5e3d9d2aced5ebb672c72ef52b2a /web/src/widget | |
parent | 0f2e20f5e5b1f0658ab4e6cbe6fdda9ca97f2b36 (diff) | |
download | iced-95988e8e251d5e416698d3883f85a469daed6365.tar.gz iced-95988e8e251d5e416698d3883f85a469daed6365.tar.bz2 iced-95988e8e251d5e416698d3883f85a469daed6365.zip |
Add several missing style attributes in iced_web.
Diffstat (limited to 'web/src/widget')
-rw-r--r-- | web/src/widget/button.rs | 4 | ||||
-rw-r--r-- | web/src/widget/column.rs | 8 | ||||
-rw-r--r-- | web/src/widget/row.rs | 8 | ||||
-rw-r--r-- | web/src/widget/text.rs | 7 | ||||
-rw-r--r-- | web/src/widget/text_input.rs | 6 |
5 files changed, 26 insertions, 7 deletions
diff --git a/web/src/widget/button.rs b/web/src/widget/button.rs index 4cc8b3de..e628bd18 100644 --- a/web/src/widget/button.rs +++ b/web/src/widget/button.rs @@ -130,6 +130,7 @@ where ) -> dodrio::Node<'b> { use dodrio::builder::*; + let width = style::length(self.width); let padding_class = style_sheet.insert(bump, Style::Padding(self.padding)); @@ -149,9 +150,10 @@ where "style", bumpalo::format!( in bump, - "background: {}; border-radius: {}px; min-width: {}px", + "background: {}; border-radius: {}px; width:{}; min-width: {}px", background, self.border_radius, + width, self.min_width ) .into_bump_str(), diff --git a/web/src/widget/column.rs b/web/src/widget/column.rs index cc850f5f..e0e49148 100644 --- a/web/src/widget/column.rs +++ b/web/src/widget/column.rs @@ -133,6 +133,8 @@ impl<'a, Message> Widget<Message> for Column<'a, Message> { let width = style::length(self.width); let height = style::length(self.height); + let align_items = style::align(self.align_items); + // TODO: Complete styling div(bump) .attr( @@ -142,10 +144,12 @@ impl<'a, Message> Widget<Message> for Column<'a, Message> { ) .attr("style", bumpalo::format!( in bump, - "width: {}; height: {}; max-width: {}px", + "width: {}; height: {}; max-width: {}px; max-height: {}px; align-items: {}", width, height, - self.max_width + self.max_width, + self.max_height, + align_items ).into_bump_str() ) .children(children) diff --git a/web/src/widget/row.rs b/web/src/widget/row.rs index e47478be..02754e2e 100644 --- a/web/src/widget/row.rs +++ b/web/src/widget/row.rs @@ -134,6 +134,8 @@ impl<'a, Message> Widget<Message> for Row<'a, Message> { let width = style::length(self.width); let height = style::length(self.height); + let justify_content = style::align(self.align_items); + // TODO: Complete styling div(bump) .attr( @@ -143,10 +145,12 @@ impl<'a, Message> Widget<Message> for Row<'a, Message> { ) .attr("style", bumpalo::format!( in bump, - "width: {}; height: {}; max-width: {}px", + "width: {}; height: {}; max-width: {}px; max-height: {}px; justify-content: {}", width, height, - self.max_width + self.max_width, + self.max_height, + justify_content ).into_bump_str() ) .children(children) diff --git a/web/src/widget/text.rs b/web/src/widget/text.rs index 6194a12e..2fdbc0a6 100644 --- a/web/src/widget/text.rs +++ b/web/src/widget/text.rs @@ -119,6 +119,9 @@ impl<'a, Message> Widget<Message> for Text { let content = bumpalo::format!(in bump, "{}", self.content); let color = style::color(self.color.unwrap_or(Color::BLACK)); + let width = style::length(self.width); + let height = style::length(self.height); + let text_align = match self.horizontal_alignment { HorizontalAlignment::Left => "left", HorizontalAlignment::Center => "center", @@ -127,7 +130,9 @@ impl<'a, Message> Widget<Message> for Text { let style = bumpalo::format!( in bump, - "font-size: {}px; color: {}; text-align: {}", + "width: {}; height: {}; font-size: {}px; color: {}; text-align: {}", + width, + height, self.size.unwrap_or(20), color, text_align diff --git a/web/src/widget/text_input.rs b/web/src/widget/text_input.rs index d6357512..99792c84 100644 --- a/web/src/widget/text_input.rs +++ b/web/src/widget/text_input.rs @@ -128,6 +128,8 @@ where use dodrio::builder::*; use wasm_bindgen::JsCast; + let width = style::length(self.width); + let max_width = style::length(self.max_width); let padding_class = style_sheet.insert(bump, Style::Padding(self.padding)); @@ -143,7 +145,9 @@ where "style", bumpalo::format!( in bump, - "font-size: {}px", + "width: {}; max-width: {}; font-size: {}px", + width, + max_width, self.size.unwrap_or(20) ) .into_bump_str(), |