Add components example

Re-arrange generics on mouse event handler
Add TypeTag struct for dynamically tagged components
This commit is contained in:
Mikayla 2023-08-15 03:06:43 -07:00
parent 5ce7ccac32
commit e5eed29c72
No known key found for this signature in database
49 changed files with 585 additions and 155 deletions

View file

@ -416,7 +416,7 @@ impl BufferSearchBar {
let tooltip_style = theme::current(cx).tooltip.clone();
let is_active = self.search_options.contains(option);
Some(
MouseEventHandler::<Self, _>::new(option.bits as usize, cx, |state, cx| {
MouseEventHandler::new::<Self, _>(option.bits as usize, cx, |state, cx| {
let theme = theme::current(cx);
let style = theme
.search
@ -463,7 +463,7 @@ impl BufferSearchBar {
let tooltip_style = theme::current(cx).tooltip.clone();
enum NavButton {}
MouseEventHandler::<NavButton, _>::new(direction as usize, cx, |state, cx| {
MouseEventHandler::new::<NavButton, _>(direction as usize, cx, |state, cx| {
let theme = theme::current(cx);
let style = theme.search.option_button.inactive_state().style_for(state);
Label::new(icon, style.text.clone())
@ -497,7 +497,7 @@ impl BufferSearchBar {
let action_type_id = 0_usize;
enum ActionButton {}
MouseEventHandler::<ActionButton, _>::new(action_type_id, cx, |state, cx| {
MouseEventHandler::new::<ActionButton, _>(action_type_id, cx, |state, cx| {
let theme = theme::current(cx);
let style = theme.search.action_button.style_for(state);
Label::new(icon, style.text.clone())
@ -527,7 +527,7 @@ impl BufferSearchBar {
let tooltip_style = theme::current(cx).tooltip.clone();
enum CloseButton {}
MouseEventHandler::<CloseButton, _>::new(0, cx, |state, _| {
MouseEventHandler::new::<CloseButton, _>(0, cx, |state, _| {
let style = theme.dismiss_button.style_for(state);
Svg::new("icons/x_mark_8.svg")
.with_color(style.color)

View file

@ -328,7 +328,7 @@ impl View for ProjectSearchView {
editor.set_placeholder_text(new_placeholder_text, cx);
});
MouseEventHandler::<Status, _>::new(0, cx, |_, _| {
MouseEventHandler::new::<Status, _>(0, cx, |_, _| {
Label::new(text, theme.search.results_status.clone())
.aligned()
.contained()
@ -1103,7 +1103,7 @@ impl ProjectSearchBar {
let tooltip_style = theme::current(cx).tooltip.clone();
enum NavButton {}
MouseEventHandler::<NavButton, _>::new(direction as usize, cx, |state, cx| {
MouseEventHandler::new::<NavButton, _>(direction as usize, cx, |state, cx| {
let theme = theme::current(cx);
let style = theme.search.option_button.inactive_state().style_for(state);
Label::new(icon, style.text.clone())
@ -1134,7 +1134,7 @@ impl ProjectSearchBar {
) -> AnyElement<Self> {
let tooltip_style = theme::current(cx).tooltip.clone();
let is_active = self.is_option_enabled(option, cx);
MouseEventHandler::<Self, _>::new(option.bits as usize, cx, |state, cx| {
MouseEventHandler::new::<Self, _>(option.bits as usize, cx, |state, cx| {
let theme = theme::current(cx);
let style = theme
.search
@ -1170,7 +1170,7 @@ impl ProjectSearchBar {
let region_id = 3;
MouseEventHandler::<Self, _>::new(region_id, cx, |state, cx| {
MouseEventHandler::new::<Self, _>(region_id, cx, |state, cx| {
let theme = theme::current(cx);
let style = theme
.search