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
commit 61bd6bab09
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
26 changed files with 420 additions and 263 deletions

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)

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)