Button2 – Part1 (#3420)

## TODO

- [x] Remove `InteractionState`
- [ ] `Selectable` should use `Selection` instead of a boolean
- [x] Clean out ui2 prelude
- [ ] Build out button2 button types
- [ ] Port old buttons

Release Notes:

- N/A

---------

Co-authored-by: Marshall Bowers <1486634+maxdeviant@users.noreply.github.com>
This commit is contained in:
Nate Butler 2023-11-29 12:23:09 -05:00 committed by GitHub
parent 5d59108b97
commit a8bf0834e6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
22 changed files with 567 additions and 339 deletions

View file

@ -37,7 +37,10 @@ use gpui::{
};
use project::Project;
use theme::ActiveTheme;
use ui::{h_stack, Avatar, Button, ButtonVariant, Color, IconButton, KeyBinding, Tooltip};
use ui::{
h_stack, Avatar, Button, ButtonCommon, ButtonLike, ButtonVariant, Clickable, Color, IconButton,
IconElement, IconSize, KeyBinding, Tooltip,
};
use util::ResultExt;
use workspace::{notifications::NotifyResultExt, Workspace};
@ -298,6 +301,27 @@ impl Render for CollabTitlebarItem {
})
.detach();
}))
// Temporary, will be removed when the last part of button2 is merged
.child(
div().border().border_color(gpui::blue()).child(
ButtonLike::new("test-button")
.children([
Avatar::uri(
"https://avatars.githubusercontent.com/u/1714999?v=4",
)
.into_element()
.into_any(),
IconElement::new(ui::Icon::ChevronDown)
.size(IconSize::Small)
.into_element()
.into_any(),
])
.on_click(move |event, _cx| {
dbg!(format!("clicked: {:?}", event.down.position));
})
.tooltip(|cx| Tooltip::text("Test tooltip", cx)),
),
)
}
})
}