Crates.io | material_you |
lib.rs | material_you |
version | 0.1.1 |
source | src |
created_at | 2022-10-14 21:37:59.047829 |
updated_at | 2023-07-03 19:18:50.023787 |
description | A design system for wasm apps based on rust and material design 3 |
homepage | https://material-rs.gitlab.io/material_you_rs |
repository | https://gitlab.com/material-rs/material_you_rs.git |
max_upload_size | |
id | 688574 |
size | 93,948 |
working on, (not ready usable) see project website at https://material-rs.gitlab.io/material_you_rs
rust install rust
add wasm32 target
rustup target add wasm32-unknown-unknown
cargo install wasm-pack wasm-bindgen-cli cargo-watch
python http.server
git clone https://gitlab.com/material-rs/material_you_rs
cd /path/of/material_you_rs
wasm-pack build website --target no-modules
cd website
python3 -m http.server
now you can see example site on your browser
cd /path/of/material_you_rs
cargo watch -w . -i .git -i .gitignore -i Cargo.lock -i target -i website/pkg "wasm-pack build website --target no-modules"
cd /path/of/material_you_rs/website
python3 -m http.server
currently we working on yew's api, but in the future we hope can provide an api for all rustwasm frameworks
implement basic token mappings of material design
implement theming provider
implement components
implement theme generator
warning this section is outdated, usage and examples needs be updated.
Cargo.toml
cargo add material_you
use yew::prelude::{function_component, html};
use material_you::provider::MaterialProvider;
#[function_component(MyApp)]
fn my_app() -> Html {
// MaterialProvider provides context info for material design
// for theming, icons, typography
html! { <MaterialProvider>
<p>{"My App"}</p>
</MaterialProvider> }
}
use yew::prelude::{function_component, html};
use material_you::{
color::ColorRole,
components::card::{
Card,
CardKind,
FilledCard,
},
css,
provider::MaterialProvider
};
#[function_component(MyComponent)]
fn my_component() -> Html {
let styles = {
let custom_styles = css::new_style("div", r#"margin: 8px;"#);
vec![custom_styles]
};
let custom_bg_role = ColorRole::Tertiary;
html! { <div>
<Card bg_role={custom_bg_role} styles={styles.clone()} >{"ElevatedCard is the default card"}</Card>
<Card kind={CardKind::Outlined} styles={styles.clone()} >{"Outlined Card"}</Card>
<FilledCard styles={styles.clone()} >{"Filled card"}</FilledCard>
</div> }
}
#[function_component(MyApp)]
fn my_app() -> Html {
html! { <MaterialProvider>
<MyComponent />
</MaterialProvider> }
}
working on... (we have not defined the development cycle)
I am an independent computer developer and researcher. My work is progressing slowly because I live on the edge. I have been looking for a job for several years to be able to live and continue with my work but it is easier said than done.
If you believe in my code and want to support my work you can give me a job or support me trough patreon.