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/slider.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'web/src/widget/slider.rs') diff --git a/web/src/widget/slider.rs b/web/src/widget/slider.rs index 25c57933..843003e6 100644 --- a/web/src/widget/slider.rs +++ b/web/src/widget/slider.rs @@ -4,7 +4,7 @@ //! //! [`Slider`]: struct.Slider.html //! [`State`]: struct.State.html -use crate::{style, Bus, Element, Length, Widget}; +use crate::{Bus, Css, Element, Length, Widget}; use dodrio::bumpalo; use std::{ops::RangeInclusive, rc::Rc}; @@ -88,7 +88,7 @@ where &self, bump: &'b bumpalo::Bump, bus: &Bus, - _style_sheet: &mut style::Sheet<'b>, + _style_sheet: &mut Css<'b>, ) -> dodrio::Node<'b> { use dodrio::builder::*; use wasm_bindgen::JsCast; -- cgit From c2dad2942916ba30435a8e26ccca17f64c092b44 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Thu, 6 Feb 2020 00:20:55 +0100 Subject: Expose styling types for `slider` in `iced_web` --- web/src/widget/slider.rs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'web/src/widget/slider.rs') diff --git a/web/src/widget/slider.rs b/web/src/widget/slider.rs index 843003e6..5aa6439e 100644 --- a/web/src/widget/slider.rs +++ b/web/src/widget/slider.rs @@ -6,6 +6,8 @@ //! [`State`]: struct.State.html use crate::{Bus, Css, Element, Length, Widget}; +pub use iced_style::slider::{Handle, HandleShape, Style, StyleSheet}; + use dodrio::bumpalo; use std::{ops::RangeInclusive, rc::Rc}; @@ -38,6 +40,7 @@ pub struct Slider<'a, Message> { value: f32, on_change: Rc Message>>, width: Length, + style: Box, } impl<'a, Message> Slider<'a, Message> { @@ -68,6 +71,7 @@ impl<'a, Message> Slider<'a, Message> { range, on_change: Rc::new(Box::new(on_change)), width: Length::Fill, + style: Default::default(), } } @@ -78,6 +82,14 @@ impl<'a, Message> Slider<'a, Message> { self.width = width; self } + + /// Sets the style of the [`Slider`]. + /// + /// [`Slider`]: struct.Slider.html + pub fn style(mut self, style: impl Into>) -> Self { + self.style = style.into(); + self + } } impl<'a, Message> Widget for Slider<'a, Message> @@ -103,7 +115,7 @@ where let event_bus = bus.clone(); // TODO: Make `step` configurable - // TODO: Complete styling + // TODO: Styling input(bump) .attr("type", "range") .attr("step", "0.01") -- cgit