Closed Dejan-Ilic closed 1 year ago
How about something more general: a style
keyword argument, that can be set to (width="100%",)
for full width?
See https://juliapluto.github.io/HypertextLiteral.jl/stable/attribute/
Ok I'll try that.
If I understand correctly, you'd like me to add the keyword style
to the function Slider
, like so:
Slider([...], style)
and then a corresponding field to the struct Slider
, like so:
struct Slider
[...]
style
end
But I am not sure about the type annotations.
And do you want me to keep my original function with the width
keyword and rewrite it as
Slider([...] width::String = "20%")
? Because Slider([...] style=(width="100%",))
would, in my opinion, be a bit too cumbersome to just enlarge the Slider.
I went ahead and added both a style
and a width
kwarg, both are more general than before, as demonstrated by this screenshot:
When both style
and width
are used, width
is ignored.
Or if you'd prefer the Slider function as a oneliner using the ternary operator, I could rewrite its body as
Slider(values, (default === missing) ? first(values) : convert(T, default),
show_value,
(style === missing) ? ((width === missing) ? (width="25%",) : (width=width,)) : style)
Sorry this is my first time contributing and I' pretty sure I've messed something up while merging. I'll try again later
I added a keyword argument
width
toSlider
ranging from 0.0 (0% width) to 1.0 (100% width) so users can conveniently resize their sliders. This gives us more fine-grained control. I set the default to 0.2, i.e. 20%, width.I did not implement any bounds checks, i.e.
min(1.0, max(0.0, slider.width))
.Screenshot: