ui: Fix switch component style when focused (#35678)
Just making sure the switch's dimensions aren't affected by the need to having an outer border to represent focus. Release Notes: - N/A
This commit is contained in:
parent
30414d154e
commit
f10ffc2a72
1 changed files with 24 additions and 21 deletions
|
@ -504,15 +504,12 @@ impl RenderOnce for Switch {
|
||||||
|
|
||||||
let group_id = format!("switch_group_{:?}", self.id);
|
let group_id = format!("switch_group_{:?}", self.id);
|
||||||
|
|
||||||
let switch = h_flex()
|
let switch = div()
|
||||||
.w(DynamicSpacing::Base32.rems(cx))
|
.id((self.id.clone(), "switch"))
|
||||||
.h(DynamicSpacing::Base20.rems(cx))
|
|
||||||
.group(group_id.clone())
|
|
||||||
.border_1()
|
|
||||||
.p(px(1.0))
|
.p(px(1.0))
|
||||||
|
.border_2()
|
||||||
.border_color(cx.theme().colors().border_transparent)
|
.border_color(cx.theme().colors().border_transparent)
|
||||||
.rounded_full()
|
.rounded_full()
|
||||||
.id((self.id.clone(), "switch"))
|
|
||||||
.when_some(
|
.when_some(
|
||||||
self.tab_index.filter(|_| !self.disabled),
|
self.tab_index.filter(|_| !self.disabled),
|
||||||
|this, tab_index| {
|
|this, tab_index| {
|
||||||
|
@ -522,6 +519,11 @@ impl RenderOnce for Switch {
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
.child(
|
||||||
|
h_flex()
|
||||||
|
.w(DynamicSpacing::Base32.rems(cx))
|
||||||
|
.h(DynamicSpacing::Base20.rems(cx))
|
||||||
|
.group(group_id.clone())
|
||||||
.child(
|
.child(
|
||||||
h_flex()
|
h_flex()
|
||||||
.when(is_on, |on| on.justify_end())
|
.when(is_on, |on| on.justify_end())
|
||||||
|
@ -542,6 +544,7 @@ impl RenderOnce for Switch {
|
||||||
.bg(thumb_color)
|
.bg(thumb_color)
|
||||||
.opacity(thumb_opacity),
|
.opacity(thumb_opacity),
|
||||||
),
|
),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
h_flex()
|
h_flex()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue