summaryrefslogtreecommitdiffstats
path: root/web/src/widget/column.rs
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón <hector0193@gmail.com>2020-02-06 10:21:52 -0600
committerLibravatar GitHub <noreply@github.com>2020-02-06 10:21:52 -0600
commit97c308076ff93d09eb874f8e954aae4c7c5deaf7 (patch)
treec3a4ec76931c8153c932c364fa393e25d39d74f0 /web/src/widget/column.rs
parent7b892eb3e11596925a2993bcc4175ac09ff3768a (diff)
parent36e617ae70cc7a86ce998cbd61f6aa702bb42933 (diff)
downloadiced-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/column.rs')
-rw-r--r--web/src/widget/column.rs29
1 files changed, 12 insertions, 17 deletions
diff --git a/web/src/widget/column.rs b/web/src/widget/column.rs
index 9aa988ff..6454ffba 100644
--- a/web/src/widget/column.rs
+++ b/web/src/widget/column.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> Column<'a, Message> {
Column {
spacing: 0,
padding: 0,
- width: Length::Shrink,
+ width: Length::Fill,
height: Length::Shrink,
max_width: u32::MAX,
max_height: u32::MAX,
@@ -112,7 +112,7 @@ impl<'a, Message> Widget<Message> for Column<'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::*;
@@ -122,18 +122,13 @@ impl<'a, Message> Widget<Message> for Column<'a, Message> {
.map(|element| element.widget.node(bump, publish, style_sheet))
.collect();
- let column_class = style_sheet.insert(bump, Style::Column);
+ let column_class = style_sheet.insert(bump, css::Rule::Column);
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 align_items = style::align(self.align_items);
+ style_sheet.insert(bump, css::Rule::Padding(self.padding));
// TODO: Complete styling
div(bump)
@@ -144,12 +139,12 @@ impl<'a, Message> Widget<Message> for Column<'a, Message> {
)
.attr("style", bumpalo::format!(
in bump,
- "width: {}; height: {}; max-width: {}px; max-height: {}px; align-items: {}",
- width,
- height,
- self.max_width,
- self.max_height,
- align_items
+ "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)