From 0030bcbd33f5c4db60aac826552042e46b51c691 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Wed, 5 Feb 2020 00:23:22 +0100 Subject: Rename module `style` to `css` in `iced_web` --- web/src/widget/text.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'web/src/widget/text.rs') diff --git a/web/src/widget/text.rs b/web/src/widget/text.rs index 5b0bee55..c5b07747 100644 --- a/web/src/widget/text.rs +++ b/web/src/widget/text.rs @@ -1,5 +1,5 @@ use crate::{ - style, Bus, Color, Element, Font, HorizontalAlignment, Length, + css, Bus, Color, Css, Element, Font, HorizontalAlignment, Length, VerticalAlignment, Widget, }; use dodrio::bumpalo; @@ -112,15 +112,15 @@ impl<'a, Message> Widget for Text { &self, bump: &'b bumpalo::Bump, _publish: &Bus, - _style_sheet: &mut style::Sheet<'b>, + _style_sheet: &mut Css<'b>, ) -> dodrio::Node<'b> { use dodrio::builder::*; let content = bumpalo::format!(in bump, "{}", self.content); - let color = style::color(self.color.unwrap_or(Color::BLACK)); + let color = css::color(self.color.unwrap_or(Color::BLACK)); - let width = style::length(self.width); - let height = style::length(self.height); + let width = css::length(self.width); + let height = css::length(self.height); let text_align = match self.horizontal_alignment { HorizontalAlignment::Left => "left", -- cgit From 28fd9feb40a024ea29f73fa91c21fc3f2cf01d58 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Wed, 5 Feb 2020 01:04:46 +0100 Subject: Support styling for `Button` in `iced_web` --- web/src/widget/text.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'web/src/widget/text.rs') diff --git a/web/src/widget/text.rs b/web/src/widget/text.rs index c5b07747..46230fef 100644 --- a/web/src/widget/text.rs +++ b/web/src/widget/text.rs @@ -117,7 +117,10 @@ impl<'a, Message> Widget for Text { use dodrio::builder::*; let content = bumpalo::format!(in bump, "{}", self.content); - let color = css::color(self.color.unwrap_or(Color::BLACK)); + let color = self + .color + .map(css::color) + .unwrap_or(String::from("inherit")); let width = css::length(self.width); let height = css::length(self.height); -- cgit From f719ba3f4efebdf29cd5922d9e083f8dea96c486 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Thu, 6 Feb 2020 05:03:11 +0100 Subject: Add `font-family` to `Text` style in `iced_web` --- web/src/widget/text.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'web/src/widget/text.rs') diff --git a/web/src/widget/text.rs b/web/src/widget/text.rs index 46230fef..3ec565a8 100644 --- a/web/src/widget/text.rs +++ b/web/src/widget/text.rs @@ -133,12 +133,16 @@ impl<'a, Message> Widget for Text { let style = bumpalo::format!( in bump, - "width: {}; height: {}; font-size: {}px; color: {}; text-align: {}", + "width: {}; height: {}; font-size: {}px; color: {}; text-align: {}; font-family: {}", width, height, self.size.unwrap_or(20), color, - text_align + text_align, + match self.font { + Font::Default => "inherit", + Font::External { name, .. } => name, + } ); // TODO: Complete styling -- cgit