Add styles for branch create button
This commit is contained in:
parent
4a69c71167
commit
92a0a4e367
3 changed files with 38 additions and 13 deletions
|
@ -253,12 +253,11 @@ impl PickerDelegate for BranchListDelegate {
|
||||||
let style = theme.picker.footer.clone();
|
let style = theme.picker.footer.clone();
|
||||||
enum BranchCreateButton {}
|
enum BranchCreateButton {}
|
||||||
Some(
|
Some(
|
||||||
Flex::row().with_child(MouseEventHandler::<BranchCreateButton, _>::new(0, cx, |_, _| {
|
Flex::row().with_child(MouseEventHandler::<BranchCreateButton, _>::new(0, cx, |state, _| {
|
||||||
|
let style = style.style_for(state);
|
||||||
Label::new("Create branch", style.label.clone())
|
Label::new("Create branch", style.label.clone())
|
||||||
.contained()
|
.contained()
|
||||||
.with_style(style.container)
|
.with_style(style.container)
|
||||||
.aligned()
|
|
||||||
.right()
|
|
||||||
})
|
})
|
||||||
.on_down(MouseButton::Left, |_, _, cx| {
|
.on_down(MouseButton::Left, |_, _, cx| {
|
||||||
cx.spawn(|picker, mut cx| async move {
|
cx.spawn(|picker, mut cx| async move {
|
||||||
|
@ -294,7 +293,7 @@ impl PickerDelegate for BranchListDelegate {
|
||||||
Ok::<(), anyhow::Error>(())
|
Ok::<(), anyhow::Error>(())
|
||||||
})
|
})
|
||||||
}).detach();
|
}).detach();
|
||||||
}))
|
})).aligned().right()
|
||||||
.into_any(),
|
.into_any(),
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -586,7 +586,7 @@ pub struct Picker {
|
||||||
pub no_matches: ContainedLabel,
|
pub no_matches: ContainedLabel,
|
||||||
pub item: Toggleable<Interactive<ContainedLabel>>,
|
pub item: Toggleable<Interactive<ContainedLabel>>,
|
||||||
pub header: ContainedLabel,
|
pub header: ContainedLabel,
|
||||||
pub footer: ContainedLabel,
|
pub footer: Interactive<ContainedLabel>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, Deserialize, Default, JsonSchema)]
|
#[derive(Clone, Debug, Deserialize, Default, JsonSchema)]
|
||||||
|
|
|
@ -119,14 +119,40 @@ export default function picker(): any {
|
||||||
right: 8,
|
right: 8,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
footer: {
|
footer: interactive({
|
||||||
|
base: {
|
||||||
text: text(theme.lowest, "sans", "variant", { size: "xs" }),
|
text: text(theme.lowest, "sans", "variant", { size: "xs" }),
|
||||||
|
padding: {
|
||||||
|
bottom: 4,
|
||||||
|
left: 12,
|
||||||
|
right: 12,
|
||||||
|
top: 4,
|
||||||
|
},
|
||||||
margin: {
|
margin: {
|
||||||
top: 1,
|
top: 1,
|
||||||
left: 8,
|
left: 4,
|
||||||
right: 8,
|
right: 4,
|
||||||
|
},
|
||||||
|
corner_radius: 8,
|
||||||
|
background: with_opacity(
|
||||||
|
background(theme.lowest, "active"),
|
||||||
|
0.5
|
||||||
|
),
|
||||||
|
},
|
||||||
|
state: {
|
||||||
|
hovered: {
|
||||||
|
background: with_opacity(
|
||||||
|
background(theme.lowest, "hovered"),
|
||||||
|
0.5
|
||||||
|
),
|
||||||
|
},
|
||||||
|
clicked: {
|
||||||
|
background: with_opacity(
|
||||||
|
background(theme.lowest, "pressed"),
|
||||||
|
0.5
|
||||||
|
),
|
||||||
},
|
},
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue