-
-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
212 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Accessibility | ||
|
||
TODO | ||
|
||
### `use_focus` hook | ||
|
||
```rs | ||
fn app() -> Element { | ||
let mut my_focus = use_focus(); | ||
|
||
rsx!( | ||
rect { | ||
width: "100%", | ||
height: "100%", | ||
focus_id: my_focus.attribute(), | ||
onclick: move |_| my_focus.focus(), | ||
label { | ||
"{my_focus.is_focused()}" | ||
} | ||
} | ||
) | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,5 @@ | ||
# i18n | ||
|
||
You may add i18n (localization) support to your Freya app by using the [**dioxus-i18n**](https://github.com/dioxus-community/dioxus-i18n) crate. | ||
|
||
[Code Example](https://github.com/dioxus-community/dioxus-i18n/blob/main/examples/freya.rs). |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,10 @@ | ||
# State Management | ||
|
||
Dioxus and thus Freya apps, don't have a single type of state management. | ||
|
||
See the different options: | ||
|
||
- [Signals](./state_management/signals.md) | ||
- [Global Signals](./state_management/globla_signals.md) | ||
- [Context](./state_management/context.md) | ||
- [Third Party](./state_management/third_party.md) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,35 @@ | ||
# Global Signals | ||
|
||
Global Signals behave like Signals but you declare them statitically and you don't need to pass them through props or context as you can just import it. | ||
Main use case is for apps, not libraries. | ||
|
||
Example: | ||
|
||
```rs | ||
|
||
static COUNT: GlobalSignal<usize> = Signal::global(|| 0); | ||
|
||
fn app() -> Element { | ||
let onclick = move |_| { | ||
COUNT += 1; // Modify the global signal, as if it was a normal signal | ||
}; | ||
|
||
rsx!( | ||
label { | ||
onclick, | ||
"{COUNT}" // Read the global signal | ||
} | ||
SomeOtherComp {} | ||
) | ||
} | ||
|
||
#[component] | ||
fn SomeOtherComp() -> Element { | ||
rsx!( | ||
label { | ||
"{COUNT}" // We can use the global signal here again | ||
} | ||
) | ||
} | ||
|
||
``` |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# Third Party | ||
|
||
### dioxus-query | ||
|
||
https://github.com/marc2332/dioxus-query | ||
|
||
|
||
### dioxus-radio | ||
|
||
https://github.com/dioxus-community/dioxus-radio | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,66 @@ | ||
# Themes | ||
|
||
All the built-in components of Freya support themes, so if you find yourself wanting to tweak a certain style attribute of a component you might want to see if it can be changed through a theme. | ||
|
||
### ThemeProvider | ||
|
||
You can pass a ThemeProvider to your whole app or maybe just a part of it by using the ThemeProvider component. | ||
|
||
Example: | ||
|
||
```rs | ||
// A custom theme based on the Light Theme that simply tweaks some parts of the Button theme. | ||
const CUSTOM_THEME: Theme = Theme { | ||
button: ButtonTheme { | ||
background: Cow::Borrowed("rgb(230, 0, 0)"), | ||
hover_background: Cow::Borrowed("rgb(150, 0, 0)"), | ||
font_theme: FontTheme { | ||
color: Cow::Borrowed("white"), | ||
}, | ||
..LIGHT_THEME.button | ||
}, | ||
..LIGHT_THEME | ||
}; | ||
|
||
fn app() -> Element { | ||
rsx!( | ||
/// All the components descendant of this ThemeProvider will inherit the Custom Theme | ||
/// Again, this could be your whole app or maybe just a small part. | ||
ThemeProvider { | ||
theme: CUSTOM_THEME, | ||
rect { | ||
width: "100%", | ||
height: "100%", | ||
Button { | ||
label { | ||
"Cancel" | ||
} | ||
} | ||
} | ||
} | ||
) | ||
} | ||
``` | ||
|
||
### `theme` prop | ||
|
||
Most of the components also support being tweaked via their `theme` prop and with the help of the `theme_with` macro. | ||
|
||
Example: | ||
|
||
```rs | ||
fn app() -> Element { | ||
rsx!( | ||
Button { | ||
// You could pass the whole theme or maybe just a part of it | ||
theme: theme_with!(ButtonTheme { | ||
background: "red".into(), | ||
width: "200".into(), | ||
}), | ||
label { | ||
"Cancel" | ||
} | ||
} | ||
) | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters