Skip to content

Commit

Permalink
Replace examples with doc tests
Browse files Browse the repository at this point in the history
  • Loading branch information
matthunz committed Oct 27, 2023
1 parent 7c7080a commit 6f677c1
Show file tree
Hide file tree
Showing 14 changed files with 21 additions and 164 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- uses: Swatinem/rust-cache@v2
- name: Build core features
run: cargo build --verbose
- name: Build all features
run: cargo build --verbose
- name: Build lookbook
run: cd lookbook && cargo build --verbose
- name: Run tests
run: cargo test --verbose
1 change: 0 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ members = [

[dependencies]
dioxus = { git = "https://github.com/dioxuslabs/dioxus" }
dioxus-web = { git = "https://github.com/dioxuslabs/dioxus" }
# dioxus-web = { git = "https://github.com/dioxuslabs/dioxus" }
dioxus-signals = { git = "https://github.com/dioxuslabs/dioxus" }
dioxus-use-mounted = { git = "https://github.com/matthunz/dioxus-use-mounted" }
dioxus-spring = { git = "https://github.com/matthunz/dioxus-spring" }
Expand Down
17 changes: 0 additions & 17 deletions examples/button.rs

This file was deleted.

20 changes: 0 additions & 20 deletions examples/chip.rs

This file was deleted.

16 changes: 0 additions & 16 deletions examples/dialog.rs

This file was deleted.

16 changes: 0 additions & 16 deletions examples/icon.rs

This file was deleted.

36 changes: 0 additions & 36 deletions examples/navigation_rail.rs

This file was deleted.

26 changes: 0 additions & 26 deletions examples/tab_row.rs

This file was deleted.

21 changes: 0 additions & 21 deletions examples/text_field.rs

This file was deleted.

2 changes: 1 addition & 1 deletion lookbook/src/previews/text_button.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use dioxus::prelude::*;
use dioxus_material::{TextButton, use_theme};
use dioxus_material::{use_theme, TextButton};
use lookbook::preview;

/// Buttons let people take action and make choices with one tap.
Expand Down
13 changes: 13 additions & 0 deletions src/dialog.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,19 @@ use dioxus::prelude::*;
/// Dialogs provide important prompts in a user flow.
///
/// [material.io](https://m3.material.io/components/dialogs)
///
/// ```
/// use dioxus::prelude::*;
/// use dioxus_material::{Dialog, Theme};
///
/// fn app(cx: Scope) -> Element {
/// render!(
/// Theme {
/// Dialog { is_visible: true, h1 { "Dialog" } }
/// }
/// )
/// }
/// ```
#[component]
pub fn Dialog<'a>(cx: Scope<'a>, children: Element<'a>, is_visible: bool) -> Element<'a> {
let theme = use_theme(cx);
Expand Down
2 changes: 1 addition & 1 deletion src/menu.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use dioxus::prelude::*;

#[component]
pub fn Menu(cx: Scope) -> Element {
pub fn Menu(_cx: Scope) -> Element {
todo!()
}
9 changes: 3 additions & 6 deletions src/tab.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@ use dioxus::prelude::*;

#[component]
pub fn Tab<'a>(cx: Scope<'a>, children: Element<'a>) -> Element<'a> {
render!(div {
font_size: "1.2em",
padding: "10px 0",
text_align: "center",
children
})
render!(
div { font_size: "1.2em", padding: "10px 0", text_align: "center", children }
)
}

0 comments on commit 6f677c1

Please sign in to comment.