mirror of
https://github.com/storytold/craft-libs.git
synced 2026-11-17 20:25:06 +00:00
A tool bar's members take the standard control size; options and status bars keep the small one
The old toolbar's buttons were standard-size squares and its options and status bars small; Bar takes its child size from its kind.
This commit is contained in:
@@ -73,13 +73,14 @@ impl Outcome for BarOutput {
|
||||
}
|
||||
}
|
||||
|
||||
/// A bar over a chrome surface whose body holds the members in reading order at the small control size. They are one
|
||||
/// roving group unless the bar is made of [`tab_stops`](Bar::tab_stops). The bar is as tall as its tallest member plus
|
||||
/// the control padding, and takes the width it is offered. A bar of one row lays its body out as a row; a bar of
|
||||
/// several rows as a stack whose rows the caller makes with `Row`. A row too long for the bar first narrows its selects
|
||||
/// and elidable text, then scrolls, so a member past the edge is reached by Tab and revealed. A rule between groups of
|
||||
/// members is a `Divider::vertical()`. A bar with `commit_cancel` ends with a cancel and a commit button in its end
|
||||
/// region, outside the scroll; they run `BarCommands`.
|
||||
/// A bar over a chrome surface whose body holds the members in reading order: a tool bar's at the standard control
|
||||
/// size, an options or status bar's at the small one. They are one roving group unless the bar is made of
|
||||
/// [`tab_stops`](Bar::tab_stops). The bar is as tall as its tallest member plus the control padding, and takes the
|
||||
/// width it is offered. A bar of one row lays its body out as a row; a bar of several rows as a stack whose rows the
|
||||
/// caller makes with `Row`. A row too long for the bar first narrows its selects and elidable text, then scrolls, so a
|
||||
/// member past the edge is reached by Tab and revealed. A rule between groups of members is a `Divider::vertical()`. A
|
||||
/// bar with `commit_cancel` ends with a cancel and a commit button in its end region, outside the scroll; they run
|
||||
/// `BarCommands`.
|
||||
#[derive(crate::contract::Component)]
|
||||
#[component(container)]
|
||||
pub struct Bar<'a> {
|
||||
@@ -103,12 +104,13 @@ impl<'a> Bar<'a> {
|
||||
BarKind::Status => Gap::Section,
|
||||
};
|
||||
let pad = if kind == BarKind::Options { Pad::Regular } else { Pad::Control };
|
||||
let size = if kind == BarKind::Tool { ControlSize::Md } else { ControlSize::Sm };
|
||||
let mut props = ContainerProps::new()
|
||||
.surface(SurfaceKind::Chrome)
|
||||
.pad(pad)
|
||||
.sizing(Sizing::FillWidth)
|
||||
.body_gap(gap)
|
||||
.child_size(ControlSize::Sm)
|
||||
.child_size(size)
|
||||
.roving(Roving::new(NavShape::Flat))
|
||||
.layout(BodyLayout::row())
|
||||
.scroll(Scroll::horizontal());
|
||||
|
||||
Reference in New Issue
Block a user