From 9c02b374b47187e8bfe23329b384974727079e13 Mon Sep 17 00:00:00 2001 From: carlosthe19916 <2582866+carlosthe19916@users.noreply.github.com> Date: Tue, 11 Jul 2023 14:26:06 +0200 Subject: [PATCH 1/2] Use new emptystate --- src/app/mod.rs | 2 +- src/components/empty/empty.1.example | 14 ------- src/components/empty/empty.2.example | 15 ------- src/components/empty/mod.rs | 28 ------------- .../empty_state/empty_state.1.example | 27 +++++++++++++ .../empty_state/empty_state.2.example | 21 ++++++++++ .../empty_state/empty_state.3.example | 27 +++++++++++++ .../empty_state/empty_state.4.example | 27 +++++++++++++ .../empty_state/empty_state.5.example | 27 +++++++++++++ .../empty_state/empty_state.6.example | 11 +++++ .../empty_state/empty_state.7.example | 19 +++++++++ .../empty_state/empty_state.8.example | 14 +++++++ src/components/empty_state/mod.rs | 40 +++++++++++++++++++ src/components/mod.rs | 4 +- 14 files changed, 216 insertions(+), 60 deletions(-) delete mode 100644 src/components/empty/empty.1.example delete mode 100644 src/components/empty/empty.2.example delete mode 100644 src/components/empty/mod.rs create mode 100644 src/components/empty_state/empty_state.1.example create mode 100644 src/components/empty_state/empty_state.2.example create mode 100644 src/components/empty_state/empty_state.3.example create mode 100644 src/components/empty_state/empty_state.4.example create mode 100644 src/components/empty_state/empty_state.5.example create mode 100644 src/components/empty_state/empty_state.6.example create mode 100644 src/components/empty_state/empty_state.7.example create mode 100644 src/components/empty_state/empty_state.8.example create mode 100644 src/components/empty_state/mod.rs diff --git a/src/app/mod.rs b/src/app/mod.rs index 4bfb8b64..b1773251 100644 --- a/src/app/mod.rs +++ b/src/app/mod.rs @@ -31,7 +31,7 @@ pub enum Component { DescriptionList, Divider, Dropdown, - #[target(rename = "empty")] + #[target(rename = "empty_state")] EmptyState, ExpandableSection, FileUpload, diff --git a/src/components/empty/empty.1.example b/src/components/empty/empty.1.example deleted file mode 100644 index 2ff5ae4a..00000000 --- a/src/components/empty/empty.1.example +++ /dev/null @@ -1,14 +0,0 @@ -html!{ - - {"This section should explain why the state is empty, and what you can do next."} - -} \ No newline at end of file diff --git a/src/components/empty/empty.2.example b/src/components/empty/empty.2.example deleted file mode 100644 index ba884b1c..00000000 --- a/src/components/empty/empty.2.example +++ /dev/null @@ -1,15 +0,0 @@ -html!{ - - {"This section should explain why the state is empty, and what you can do next."} - -} \ No newline at end of file diff --git a/src/components/empty/mod.rs b/src/components/empty/mod.rs deleted file mode 100644 index 4d53d385..00000000 --- a/src/components/empty/mod.rs +++ /dev/null @@ -1,28 +0,0 @@ -use crate::{example, example::ExamplePage}; -use patternfly_yew::prelude::*; -use yew::prelude::*; - -pub struct EmptyStateExample {} - -impl Component for EmptyStateExample { - type Message = (); - type Properties = (); - - fn create(_: &Context) -> Self { - Self {} - } - - fn view(&self, ctx: &Context) -> Html { - let example1 = example! ("Empty state" => "empty.1.example"); - let example2 = example! ("Empty state (XLarge)" => "empty.2.example"); - - html! { - <> - - {example1} - {example2} - - - } - } -} diff --git a/src/components/empty_state/empty_state.1.example b/src/components/empty_state/empty_state.1.example new file mode 100644 index 00000000..e4a4990c --- /dev/null +++ b/src/components/empty_state/empty_state.1.example @@ -0,0 +1,27 @@ +html!{ + + {Icon::Cubes})} /> + )} + /> + + {"This represents the empty state pattern in PatternFly. Hopefully it's simple enough to use but flexible enough to meet a variety of needs."} + + + + + + + + + + + + + + + +} \ No newline at end of file diff --git a/src/components/empty_state/empty_state.2.example b/src/components/empty_state/empty_state.2.example new file mode 100644 index 00000000..b6208b2a --- /dev/null +++ b/src/components/empty_state/empty_state.2.example @@ -0,0 +1,21 @@ +html!{ + + + + {"This represents the empty state pattern in PatternFly. Hopefully it's simple enough to use but flexible enough to meet a variety of needs."} + + + + + + + + + + + + +} \ No newline at end of file diff --git a/src/components/empty_state/empty_state.3.example b/src/components/empty_state/empty_state.3.example new file mode 100644 index 00000000..5694ceba --- /dev/null +++ b/src/components/empty_state/empty_state.3.example @@ -0,0 +1,27 @@ +html!{ + + {Icon::Cubes})} /> + )} + /> + + {"This represents the empty state pattern in PatternFly. Hopefully it's simple enough to use but flexible enough to meet a variety of needs."} + + + + + + + + + + + + + + + +} \ No newline at end of file diff --git a/src/components/empty_state/empty_state.4.example b/src/components/empty_state/empty_state.4.example new file mode 100644 index 00000000..775c41b9 --- /dev/null +++ b/src/components/empty_state/empty_state.4.example @@ -0,0 +1,27 @@ +html!{ + + {Icon::Cubes})} /> + )} + /> + + {"This represents the empty state pattern in PatternFly. Hopefully it's simple enough to use but flexible enough to meet a variety of needs."} + + + + + + + + + + + + + + + +} \ No newline at end of file diff --git a/src/components/empty_state/empty_state.5.example b/src/components/empty_state/empty_state.5.example new file mode 100644 index 00000000..eca00624 --- /dev/null +++ b/src/components/empty_state/empty_state.5.example @@ -0,0 +1,27 @@ +html!{ + + {Icon::Cubes})} /> + )} + /> + + {"This represents the empty state pattern in PatternFly. Hopefully it's simple enough to use but flexible enough to meet a variety of needs."} + + + + + + + + + + + + + + + +} \ No newline at end of file diff --git a/src/components/empty_state/empty_state.6.example b/src/components/empty_state/empty_state.6.example new file mode 100644 index 00000000..828b2d2e --- /dev/null +++ b/src/components/empty_state/empty_state.6.example @@ -0,0 +1,11 @@ +html!{ + + )} /> + )} + /> + +} \ No newline at end of file diff --git a/src/components/empty_state/empty_state.7.example b/src/components/empty_state/empty_state.7.example new file mode 100644 index 00000000..b7ce7586 --- /dev/null +++ b/src/components/empty_state/empty_state.7.example @@ -0,0 +1,19 @@ +html!{ + + {Icon::Search})} /> + )} + /> + + {"No results match the filter criteria. Clear all filters and try again."} + + + + + + + +} \ No newline at end of file diff --git a/src/components/empty_state/empty_state.8.example b/src/components/empty_state/empty_state.8.example new file mode 100644 index 00000000..c2e87eae --- /dev/null +++ b/src/components/empty_state/empty_state.8.example @@ -0,0 +1,14 @@ +html!{ + + {Icon::Check})} color="var(--pf-v5-global--success-color--100)" /> + )} + /> + + {"This represents the empty state pattern in PatternFly with a custom icon color. Hopefully it's simple enough to use but flexible enough to meet a variety of needs."} + + +} \ No newline at end of file diff --git a/src/components/empty_state/mod.rs b/src/components/empty_state/mod.rs new file mode 100644 index 00000000..fc751760 --- /dev/null +++ b/src/components/empty_state/mod.rs @@ -0,0 +1,40 @@ +use crate::{example, example::ExamplePage}; +use patternfly_yew::prelude::*; +use yew::prelude::*; + +pub struct EmptyStateExample {} + +impl Component for EmptyStateExample { + type Message = (); + type Properties = (); + + fn create(_: &Context) -> Self { + Self {} + } + + fn view(&self, ctx: &Context) -> Html { + let example1 = example! ("Basic" => "empty_state.1.example"); + let example2 = example! ("Extra small" => "empty_state.2.example"); + let example3 = example! ("Small" => "empty_state.3.example"); + let example4 = example! ("Large" => "empty_state.4.example"); + let example5 = example! ("Extra large" => "empty_state.5.example"); + let example6 = example! ("Spinner" => "empty_state.6.example"); + let example7 = example! ("No match found" => "empty_state.7.example"); + let example8 = example! ("Custom icon color" => "empty_state.8.example"); + + html! { + <> + + {example1} + {example2} + {example3} + {example4} + {example5} + {example6} + {example7} + {example8} + + + } + } +} diff --git a/src/components/mod.rs b/src/components/mod.rs index bfd1bf39..d65ad322 100644 --- a/src/components/mod.rs +++ b/src/components/mod.rs @@ -14,7 +14,7 @@ mod context_selector; mod description_list; mod divider; mod dropdown; -mod empty; +mod empty_state; mod expandable_section; mod file_upload; mod form; @@ -56,7 +56,7 @@ pub use context_selector::*; pub use description_list::*; pub use divider::*; pub use dropdown::*; -pub use empty::*; +pub use empty_state::*; pub use expandable_section::*; pub use file_upload::*; pub use form::*; From fadf77b2925cee23285598b6143b887cbc23ea86 Mon Sep 17 00:00:00 2001 From: carlosthe19916 <2582866+carlosthe19916@users.noreply.github.com> Date: Tue, 11 Jul 2023 17:10:11 +0200 Subject: [PATCH 2/2] Add SimpleEmptyState examples --- src/components/empty_state/mod.rs | 6 ++++++ .../empty_state/simple_empty_state.1.example | 14 ++++++++++++++ .../empty_state/simple_empty_state.2.example | 15 +++++++++++++++ 3 files changed, 35 insertions(+) create mode 100644 src/components/empty_state/simple_empty_state.1.example create mode 100644 src/components/empty_state/simple_empty_state.2.example diff --git a/src/components/empty_state/mod.rs b/src/components/empty_state/mod.rs index fc751760..e7adb768 100644 --- a/src/components/empty_state/mod.rs +++ b/src/components/empty_state/mod.rs @@ -13,6 +13,9 @@ impl Component for EmptyStateExample { } fn view(&self, ctx: &Context) -> Html { + let example_a = example! ("Simple Empty State" => "simple_empty_state.1.example"); + let example_b = example! ("Simple Empty state (XLarge)" => "simple_empty_state.2.example"); + let example1 = example! ("Basic" => "empty_state.1.example"); let example2 = example! ("Extra small" => "empty_state.2.example"); let example3 = example! ("Small" => "empty_state.3.example"); @@ -25,6 +28,9 @@ impl Component for EmptyStateExample { html! { <> + {example_a} + {example_b} + {example1} {example2} {example3} diff --git a/src/components/empty_state/simple_empty_state.1.example b/src/components/empty_state/simple_empty_state.1.example new file mode 100644 index 00000000..359feff5 --- /dev/null +++ b/src/components/empty_state/simple_empty_state.1.example @@ -0,0 +1,14 @@ +html!{ + + {"This section should explain why the state is empty, and what you can do next."} + +} \ No newline at end of file diff --git a/src/components/empty_state/simple_empty_state.2.example b/src/components/empty_state/simple_empty_state.2.example new file mode 100644 index 00000000..e505ac71 --- /dev/null +++ b/src/components/empty_state/simple_empty_state.2.example @@ -0,0 +1,15 @@ +html!{ + + {"This section should explain why the state is empty, and what you can do next."} + +} \ No newline at end of file