Skip to content

Commit

Permalink
feat: allow setting custom css
Browse files Browse the repository at this point in the history
  • Loading branch information
BrewingWeasel committed Oct 29, 2023
1 parent 86019ae commit 661a297
Show file tree
Hide file tree
Showing 6 changed files with 233 additions and 243 deletions.
1 change: 1 addition & 0 deletions shared/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,5 @@ pub struct Settings {
pub model: String,
pub dicts: Vec<Dictionary>,
pub to_remove: Option<usize>,
pub css: Option<String>,
}
2 changes: 1 addition & 1 deletion src-tauri/build.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
fn main() {
tauri_build::build()
tauri_build::build()
}
1 change: 1 addition & 0 deletions src-tauri/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ Back:$def",
model: String::new(),
dicts: Vec::new(),
to_remove: None,
css: None,
},
}
}
Expand Down
8 changes: 5 additions & 3 deletions src-ui/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ fn App() -> impl IntoView {
let settings = create_resource(|| (), |_| async move { get_settings().await });
view! {
<Router>
<style type="text/css">
{move || settings().map(|s| s.css).flatten().unwrap_or_default()}
</style>
<nav>
<NavBar/>
</nav>
Expand All @@ -47,10 +50,9 @@ fn App() -> impl IntoView {
<Route path="/reader" view=move || ReaderView(ReaderViewProps { settings })/>
<Route
path="/settings"
view=move || SettingsChanger(SettingsChangerProps {
settings,
})
view=move || SettingsChanger(SettingsChangerProps { settings })
/>

<Route path="/dictionary" view=Todo/>
<Route path="/corpus" view=Todo/>
</Routes>
Expand Down
Loading

0 comments on commit 661a297

Please sign in to comment.