diff options
author | 2020-02-06 10:21:52 -0600 | |
---|---|---|
committer | 2020-02-06 10:21:52 -0600 | |
commit | 97c308076ff93d09eb874f8e954aae4c7c5deaf7 (patch) | |
tree | c3a4ec76931c8153c932c364fa393e25d39d74f0 /web/src/widget/row.rs | |
parent | 7b892eb3e11596925a2993bcc4175ac09ff3768a (diff) | |
parent | 36e617ae70cc7a86ce998cbd61f6aa702bb42933 (diff) | |
download | iced-97c308076ff93d09eb874f8e954aae4c7c5deaf7.tar.gz iced-97c308076ff93d09eb874f8e954aae4c7c5deaf7.tar.bz2 iced-97c308076ff93d09eb874f8e954aae4c7c5deaf7.zip |
Merge pull request #180 from hecrj/feature/web-styling
Custom styling for `iced_web`
Diffstat (limited to 'web/src/widget/row.rs')
-rw-r--r-- | web/src/widget/row.rs | 29 |
1 files changed, 12 insertions, 17 deletions
diff --git a/web/src/widget/row.rs b/web/src/widget/row.rs index c26cb91b..02035113 100644 --- a/web/src/widget/row.rs +++ b/web/src/widget/row.rs @@ -1,4 +1,4 @@ -use crate::{style, Align, Bus, Element, Length, Style, Widget}; +use crate::{css, Align, Bus, Css, Element, Length, Widget}; use dodrio::bumpalo; use std::u32; @@ -28,7 +28,7 @@ impl<'a, Message> Row<'a, Message> { Row { spacing: 0, padding: 0, - width: Length::Shrink, + width: Length::Fill, height: Length::Shrink, max_width: u32::MAX, max_height: u32::MAX, @@ -113,7 +113,7 @@ impl<'a, Message> Widget<Message> for Row<'a, Message> { &self, bump: &'b bumpalo::Bump, publish: &Bus<Message>, - style_sheet: &mut style::Sheet<'b>, + style_sheet: &mut Css<'b>, ) -> dodrio::Node<'b> { use dodrio::builder::*; @@ -123,18 +123,13 @@ impl<'a, Message> Widget<Message> for Row<'a, Message> { .map(|element| element.widget.node(bump, publish, style_sheet)) .collect(); - let row_class = style_sheet.insert(bump, Style::Row); + let row_class = style_sheet.insert(bump, css::Rule::Row); let spacing_class = - style_sheet.insert(bump, Style::Spacing(self.spacing)); + style_sheet.insert(bump, css::Rule::Spacing(self.spacing)); let padding_class = - style_sheet.insert(bump, Style::Padding(self.padding)); - - let width = style::length(self.width); - let height = style::length(self.height); - - let justify_content = style::align(self.align_items); + style_sheet.insert(bump, css::Rule::Padding(self.padding)); // TODO: Complete styling div(bump) @@ -145,12 +140,12 @@ impl<'a, Message> Widget<Message> for Row<'a, Message> { ) .attr("style", bumpalo::format!( in bump, - "width: {}; height: {}; max-width: {}px; max-height: {}px; justify-content: {}", - width, - height, - self.max_width, - self.max_height, - justify_content + "width: {}; height: {}; max-width: {}; max-height: {}; align-items: {}", + css::length(self.width), + css::length(self.height), + css::max_length(self.max_width), + css::max_length(self.max_height), + css::align(self.align_items) ).into_bump_str() ) .children(children) |