Actions‽ (#3349)

This PR re-implements our actions with macros instead of a blanket impl.

Release Notes:

- N/A
This commit is contained in:
Mikayla Maki
2023-11-16 18:18:04 -08:00
committed by GitHub
26 changed files with 420 additions and 263 deletions
+3 -2
View File
@@ -84,7 +84,8 @@ pub use stories::*;
mod stories {
use super::*;
use crate::story::Story;
use gpui::{action, Div, Render};
use gpui::{Div, Render};
use serde::Deserialize;
pub struct ContextMenuStory;
@@ -92,7 +93,7 @@ mod stories {
type Element = Div<Self>;
fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {
#[action]
#[derive(PartialEq, Clone, Deserialize, gpui::Action)]
struct PrintCurrentDate {}
Story::container(cx)
+2 -3
View File
@@ -81,13 +81,12 @@ pub use stories::*;
mod stories {
use super::*;
use crate::Story;
use gpui::{action, Div, Render};
use gpui::{actions, Div, Render};
use itertools::Itertools;
pub struct KeybindingStory;
#[action]
struct NoAction {}
actions!(NoAction);
pub fn binding(key: &str) -> gpui::KeyBinding {
gpui::KeyBinding::new(key, NoAction {}, None)