Skip to content

Commit

Permalink
improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
marc2332 committed Apr 14, 2024
1 parent 1016ee2 commit 1c0aadf
Showing 1 changed file with 33 additions and 1 deletion.
34 changes: 33 additions & 1 deletion website/src/content/blog/0.2.md
Original file line number Diff line number Diff line change
Expand Up @@ -213,9 +213,41 @@ rsx!(

See [X (Twitter) 🎥](https://x.com/mkenzo_8/status/1757766554102415496)

### 📱 NativeRouter
NativeRouter is a opt-in component to be used in combination with `dioxus-router`, it provides navigation with the `back` and `foward` buttons of the mouse, like a web browsers and some apps.

You really just need to put it inside a `Router` and then put your components inside of it, and it will just work.

Example
```rust
#[derive(Routable, Clone, PartialEq)]
#[rustfmt::skip]
pub enum Route {
#[layout(Layout)]
#[route("/")]
Home,
#[end_layout]
#[route("/..route")]
PageNotFound { },
}

// Because this component is used as layout for all the other routes
// Using the back and forward buttons will work in all of them.
#[component]
fn Layout() -> Element {
rsx!(
NativeRouter {
Outlet::<Route> { }
}
)
}
```

### 🧱 Sidebar

`Sidebar` is a new component to let you have have a menu in the left side and content in the right side, this is specially useful when used in combination with `dioxus-router`. It also supports navigating with the mouse back and forward buttons.
`Sidebar` is a new component to let you have have a menu in the left side and content in the right side, this is specially useful when used in combination with `dioxus-router` and [`NativeRouter`](#-nativerouter).

[Example Code](https://github.com/marc2332/freya/blob/main/examples/router.rs)

![image](/blog/0.2/sidebar.png)

Expand Down

0 comments on commit 1c0aadf

Please sign in to comment.