mirror of
https://github.com/adoyle0/thaw.git
synced 2025-01-22 14:09:21 -05:00
Fix/slider label position (#250)
* fix: Slider labels all stacked to the left with Firefox * perf: Slider focus-within
This commit is contained in:
parent
add97b0f7b
commit
1ab9dd4c9f
3 changed files with 17 additions and 6 deletions
|
@ -37,7 +37,6 @@ pub fn Slider(
|
|||
let (id, name) = FieldInjection::use_id_and_name(id, name);
|
||||
let validate = Rule::validate(rules, value, name);
|
||||
let is_chldren = children.is_some();
|
||||
let list_id = is_chldren.then(|| uuid::Uuid::new_v4().to_string());
|
||||
let current_value = Memo::new(move |_| {
|
||||
let max = max.get();
|
||||
let min = min.get();
|
||||
|
@ -100,14 +99,13 @@ pub fn Slider(
|
|||
on:input=on_input
|
||||
value=current_value.get_untracked()
|
||||
prop:value=move || current_value.get()
|
||||
list=list_id.clone()
|
||||
/>
|
||||
<div class="thaw-slider__rail"></div>
|
||||
<div class="thaw-slider__thumb"></div>
|
||||
<OptionComp value=children let:children>
|
||||
<datalist id=list_id class="thaw-slider__datalist">
|
||||
<div class="thaw-slider__datalist">
|
||||
{children()}
|
||||
</datalist>
|
||||
</div>
|
||||
</OptionComp>
|
||||
</div>
|
||||
</Provider>
|
||||
|
|
|
@ -33,6 +33,19 @@
|
|||
outline-style: none;
|
||||
}
|
||||
|
||||
.thaw-slider:focus-within::after {
|
||||
content: "";
|
||||
position: absolute;
|
||||
bottom: calc(0px);
|
||||
left: calc(-10px);
|
||||
right: calc(-10px);
|
||||
top: calc(0px);
|
||||
z-index: 1;
|
||||
pointer-events: none;
|
||||
border-radius: var(--borderRadiusMedium);
|
||||
border: 2px solid var(--colorStrokeFocus2);
|
||||
}
|
||||
|
||||
.thaw-slider__input {
|
||||
grid-column-end: -1;
|
||||
grid-column-start: 1;
|
||||
|
|
|
@ -20,9 +20,9 @@ pub fn SliderLabel(
|
|||
};
|
||||
|
||||
view! {
|
||||
<option class=class_list!["thaw-slider-label", class] style=style value=move || value.get()>
|
||||
<div class=class_list!["thaw-slider-label", class] style=style>
|
||||
|
||||
{children()}
|
||||
</option>
|
||||
</div>
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue