chore: Remove unnecessary examples that have includes in gallery. (#1049)

This commit is contained in:
Jason Lee 2025-07-07 12:11:19 +08:00 committed by GitHub
parent 40a2467374
commit 463c3ebfea
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
19 changed files with 3 additions and 579 deletions

View file

@ -1,35 +0,0 @@
use gpui::*;
use story::{AccordionStory, Assets};
pub struct Example {
root: Entity<AccordionStory>,
}
impl Example {
pub fn new(window: &mut Window, cx: &mut Context<Self>) -> Self {
let root = AccordionStory::view(window, cx);
Self { root }
}
fn view(window: &mut Window, cx: &mut App) -> Entity<Self> {
cx.new(|cx| Self::new(window, cx))
}
}
impl Render for Example {
fn render(&mut self, _window: &mut Window, _cx: &mut Context<Self>) -> impl IntoElement {
div().p_4().size_full().child(self.root.clone())
}
}
fn main() {
let app = Application::new().with_assets(Assets);
app.run(move |cx| {
story::init(cx);
cx.activate(true);
story::create_new_window("Accordion Example", Example::view, cx);
});
}

View file

@ -1,36 +0,0 @@
use gpui::*;
use story::{AlertStory, Assets};
pub struct Example {
story: Entity<AlertStory>,
}
impl Example {
pub fn new(window: &mut Window, cx: &mut Context<Self>) -> Self {
Self {
story: AlertStory::view(window, cx),
}
}
fn view(window: &mut Window, cx: &mut App) -> Entity<Self> {
cx.new(|cx| Self::new(window, cx))
}
}
impl Render for Example {
fn render(&mut self, _window: &mut Window, _: &mut Context<Self>) -> impl IntoElement {
self.story.clone()
}
}
fn main() {
let app = Application::new().with_assets(Assets);
app.run(move |cx| {
story::init(cx);
cx.activate(true);
story::create_new_window("Alert Example", Example::view, cx);
});
}

View file

@ -1,40 +0,0 @@
use gpui::*;
use story::{Assets, ButtonStory};
pub struct Example {
root: Entity<ButtonStory>,
}
impl Example {
pub fn new(window: &mut Window, cx: &mut Context<Self>) -> Self {
let root = ButtonStory::view(window, cx);
Self { root }
}
fn view(window: &mut Window, cx: &mut App) -> Entity<Self> {
cx.new(|cx| Self::new(window, cx))
}
}
impl Render for Example {
fn render(&mut self, _window: &mut Window, _cx: &mut Context<Self>) -> impl IntoElement {
div()
.p_4()
.id("button_example")
.overflow_y_scroll()
.size_full()
.child(self.root.clone())
}
}
fn main() {
let app = Application::new().with_assets(Assets);
app.run(move |cx| {
story::init(cx);
cx.activate(true);
story::create_new_window("Button Example", Example::view, cx);
});
}

View file

@ -1,35 +0,0 @@
use gpui::*;
use story::{Assets, FormStory};
pub struct Example {
story: Entity<FormStory>,
}
impl Example {
pub fn new(window: &mut Window, cx: &mut Context<Self>) -> Self {
let story = FormStory::view(window, cx);
Self { story }
}
fn view(window: &mut Window, cx: &mut App) -> Entity<Self> {
cx.new(|cx| Self::new(window, cx))
}
}
impl Render for Example {
fn render(&mut self, _window: &mut Window, _cx: &mut Context<Self>) -> impl IntoElement {
div().p_4().size_full().child(self.story.clone())
}
}
fn main() {
let app = Application::new().with_assets(Assets);
app.run(move |cx| {
story::init(cx);
cx.activate(true);
story::create_new_window("Form Example", Example::view, cx);
});
}

View file

@ -13,7 +13,7 @@ pub struct Example {
_subscribe: Subscription,
}
const EXAMPLE: &str = include_str!("./html.html");
const EXAMPLE: &str = include_str!("./fixtures/test.html");
impl Example {
pub fn new(window: &mut Window, cx: &mut Context<Self>) -> Self {
@ -87,6 +87,6 @@ fn main() {
story::init(cx);
cx.activate(true);
story::create_new_window("HTML Example", Example::view, cx);
story::create_new_window("HTML Render (native)", Example::view, cx);
});
}

View file

@ -1,35 +0,0 @@
use gpui::*;
use story::{Assets, InputStory};
pub struct Example {
root: Entity<InputStory>,
}
impl Example {
pub fn new(window: &mut Window, cx: &mut Context<Self>) -> Self {
let root = InputStory::view(window, cx);
Self { root }
}
fn view(window: &mut Window, cx: &mut App) -> Entity<Self> {
cx.new(|cx| Self::new(window, cx))
}
}
impl Render for Example {
fn render(&mut self, _window: &mut Window, _cx: &mut Context<Self>) -> impl IntoElement {
div().p_4().size_full().child(self.root.clone())
}
}
fn main() {
let app = Application::new().with_assets(Assets);
app.run(move |cx| {
story::init(cx);
cx.activate(true);
story::create_new_window("Input Example", Example::view, cx);
});
}

View file

@ -1,35 +0,0 @@
use gpui::*;
use story::{Assets, ListStory};
pub struct Example {
root: Entity<ListStory>,
}
impl Example {
pub fn new(window: &mut Window, cx: &mut Context<Self>) -> Self {
let root = ListStory::view(window, cx);
Self { root }
}
fn view(window: &mut Window, cx: &mut App) -> Entity<Self> {
cx.new(|cx| Self::new(window, cx))
}
}
impl Render for Example {
fn render(&mut self, _window: &mut Window, _cx: &mut Context<Self>) -> impl IntoElement {
div().p_4().size_full().child(self.root.clone())
}
}
fn main() {
let app = Application::new().with_assets(Assets);
app.run(move |cx| {
story::init(cx);
cx.activate(true);
story::create_new_window("List Example", Example::view, cx);
});
}

View file

@ -101,6 +101,6 @@ fn main() {
story::init(cx);
cx.activate(true);
story::create_new_window("Markdown Example", Example::view, cx);
story::create_new_window("Markdown Editor", Example::view, cx);
});
}

View file

@ -1,35 +0,0 @@
use gpui::*;
use story::{Assets, ModalStory};
pub struct Example {
root: Entity<ModalStory>,
}
impl Example {
pub fn new(window: &mut Window, cx: &mut Context<Self>) -> Self {
let root = ModalStory::view(window, cx);
Self { root }
}
fn view(window: &mut Window, cx: &mut App) -> Entity<Self> {
cx.new(|cx| Self::new(window, cx))
}
}
impl Render for Example {
fn render(&mut self, _window: &mut Window, _cx: &mut Context<Self>) -> impl IntoElement {
div().p_4().size_full().child(self.root.clone())
}
}
fn main() {
let app = Application::new().with_assets(Assets);
app.run(move |cx| {
story::init(cx);
cx.activate(true);
story::create_new_window("Modal Example", Example::view, cx);
});
}

View file

@ -1,35 +0,0 @@
use gpui::*;
use story::{Assets, PopoverStory};
pub struct Example {
story: Entity<PopoverStory>,
}
impl Example {
pub fn new(window: &mut Window, cx: &mut Context<Self>) -> Self {
let story = PopoverStory::view(window, cx);
Self { story }
}
fn view(window: &mut Window, cx: &mut App) -> Entity<Self> {
cx.new(|cx| Self::new(window, cx))
}
}
impl Render for Example {
fn render(&mut self, _window: &mut Window, _cx: &mut Context<Self>) -> impl IntoElement {
div().p_4().size_full().child(self.story.clone())
}
}
fn main() {
let app = Application::new().with_assets(Assets);
app.run(move |cx| {
story::init(cx);
cx.activate(true);
story::create_new_window("Popover Example", Example::view, cx);
});
}

View file

@ -1,35 +0,0 @@
use gpui::*;
use story::{Assets, ScrollableStory};
pub struct Example {
story: Entity<ScrollableStory>,
}
impl Example {
pub fn new(window: &mut Window, cx: &mut Context<Self>) -> Self {
let story = ScrollableStory::view(window, cx);
Self { story }
}
fn view(window: &mut Window, cx: &mut App) -> Entity<Self> {
cx.new(|cx| Self::new(window, cx))
}
}
impl Render for Example {
fn render(&mut self, _window: &mut Window, _cx: &mut Context<Self>) -> impl IntoElement {
div().p_4().size_full().child(self.story.clone())
}
}
fn main() {
let app = Application::new().with_assets(Assets);
app.run(move |cx| {
story::init(cx);
cx.activate(true);
story::create_new_window("Scrollable Example", Example::view, cx);
});
}

View file

@ -1,35 +0,0 @@
use gpui::*;
use story::{Assets, SidebarStory};
pub struct Example {
root: Entity<SidebarStory>,
}
impl Example {
pub fn new(window: &mut Window, cx: &mut Context<Self>) -> Self {
let root = SidebarStory::view(window, cx);
Self { root }
}
fn view(window: &mut Window, cx: &mut App) -> Entity<Self> {
cx.new(|cx| Self::new(window, cx))
}
}
impl Render for Example {
fn render(&mut self, _window: &mut Window, _cx: &mut Context<Self>) -> impl IntoElement {
div().mt(-px(1.)).size_full().child(self.root.clone())
}
}
fn main() {
let app = Application::new().with_assets(Assets);
app.run(move |cx| {
story::init(cx);
cx.activate(true);
story::create_new_window("Sidebar Example", Example::view, cx);
});
}

View file

@ -1,35 +0,0 @@
use gpui::*;
use story::{Assets, SwitchStory};
pub struct Example {
story: Entity<SwitchStory>,
}
impl Example {
pub fn new(window: &mut Window, cx: &mut Context<Self>) -> Self {
let story = SwitchStory::view(window, cx);
Self { story }
}
fn view(window: &mut Window, cx: &mut App) -> Entity<Self> {
cx.new(|cx| Self::new(window, cx))
}
}
impl Render for Example {
fn render(&mut self, _window: &mut Window, _cx: &mut Context<Self>) -> impl IntoElement {
div().p_4().size_full().child(self.story.clone())
}
}
fn main() {
let app = Application::new().with_assets(Assets);
app.run(move |cx| {
story::init(cx);
cx.activate(true);
story::create_new_window("Switch Example", Example::view, cx);
});
}

View file

@ -1,35 +0,0 @@
use gpui::*;
use story::{Assets, TableStory};
pub struct Example {
table: Entity<TableStory>,
}
impl Example {
pub fn new(window: &mut Window, cx: &mut Context<Self>) -> Self {
let table = TableStory::view(window, cx);
Self { table }
}
fn view(window: &mut Window, cx: &mut App) -> Entity<Self> {
cx.new(|cx| Self::new(window, cx))
}
}
impl Render for Example {
fn render(&mut self, _window: &mut Window, _cx: &mut Context<Self>) -> impl IntoElement {
div().p_4().size_full().child(self.table.clone())
}
}
fn main() {
let app = Application::new().with_assets(Assets);
app.run(move |cx| {
story::init(cx);
cx.activate(true);
story::create_new_window("Table Example", Example::view, cx);
});
}

View file

@ -1,35 +0,0 @@
use gpui::*;
use story::{Assets, TabsStory};
pub struct Example {
root: Entity<TabsStory>,
}
impl Example {
pub fn new(window: &mut Window, cx: &mut Context<Self>) -> Self {
let root = TabsStory::view(window, cx);
Self { root }
}
fn view(window: &mut Window, cx: &mut App) -> Entity<Self> {
cx.new(|cx| Self::new(window, cx))
}
}
impl Render for Example {
fn render(&mut self, _window: &mut Window, _cx: &mut Context<Self>) -> impl IntoElement {
div().p_4().size_full().child(self.root.clone())
}
}
fn main() {
let app = Application::new().with_assets(Assets);
app.run(move |cx| {
story::init(cx);
cx.activate(true);
story::create_new_window("Tabs Example", Example::view, cx);
});
}

View file

@ -1,40 +0,0 @@
use gpui::*;
use story::{Assets, LabelStory};
pub struct Example {
root: Entity<LabelStory>,
}
impl Example {
pub fn new(window: &mut Window, cx: &mut Context<Self>) -> Self {
let root = LabelStory::view(window, cx);
Self { root }
}
fn view(window: &mut Window, cx: &mut App) -> Entity<Self> {
cx.new(|cx| Self::new(window, cx))
}
}
impl Render for Example {
fn render(&mut self, _window: &mut Window, _cx: &mut Context<Self>) -> impl IntoElement {
div()
.p_4()
.id("example")
.overflow_y_scroll()
.size_full()
.child(self.root.clone())
}
}
fn main() {
let app = Application::new().with_assets(Assets);
app.run(move |cx| {
story::init(cx);
cx.activate(true);
story::create_new_window("List Example", Example::view, cx);
});
}

View file

@ -1,35 +0,0 @@
use gpui::*;
use story::{Assets, ToggleStory};
pub struct Example {
root: Entity<ToggleStory>,
}
impl Example {
pub fn new(window: &mut Window, cx: &mut Context<Self>) -> Self {
let root = ToggleStory::view(window, cx);
Self { root }
}
fn view(window: &mut Window, cx: &mut App) -> Entity<Self> {
cx.new(|cx| Self::new(window, cx))
}
}
impl Render for Example {
fn render(&mut self, _window: &mut Window, _cx: &mut Context<Self>) -> impl IntoElement {
div().p_4().size_full().child(self.root.clone())
}
}
fn main() {
let app = Application::new().with_assets(Assets);
app.run(move |cx| {
story::init(cx);
cx.activate(true);
story::create_new_window("Toggle Example", Example::view, cx);
});
}

View file

@ -1,40 +0,0 @@
use gpui::*;
use story::{Assets, TooltipStory};
pub struct Example {
root: Entity<TooltipStory>,
}
impl Example {
pub fn new(window: &mut Window, cx: &mut Context<Self>) -> Self {
let root = TooltipStory::view(window, cx);
Self { root }
}
fn view(window: &mut Window, cx: &mut App) -> Entity<Self> {
cx.new(|cx| Self::new(window, cx))
}
}
impl Render for Example {
fn render(&mut self, _window: &mut Window, _cx: &mut Context<Self>) -> impl IntoElement {
div()
.p_4()
.id("example")
.overflow_y_scroll()
.size_full()
.child(self.root.clone())
}
}
fn main() {
let app = Application::new().with_assets(Assets);
app.run(move |cx| {
story::init(cx);
cx.activate(true);
story::create_new_window("Tooltip Example", Example::view, cx);
});
}