mirror of
https://github.com/adoyle0/thaw.git
synced 2025-03-12 05:32:55 -04:00
pref: fmt and clippy
This commit is contained in:
parent
abbaebbfe5
commit
5c9104d453
3 changed files with 12 additions and 25 deletions
|
@ -7,7 +7,7 @@ pub fn SiteHeader() -> impl IntoView {
|
||||||
let theme = use_rw_theme();
|
let theme = use_rw_theme();
|
||||||
let theme_name = create_memo(move |_| {
|
let theme_name = create_memo(move |_| {
|
||||||
theme.with(|theme| {
|
theme.with(|theme| {
|
||||||
if theme.name == "light".to_string() {
|
if theme.name == *"light" {
|
||||||
"Dark"
|
"Dark"
|
||||||
} else {
|
} else {
|
||||||
"Light"
|
"Light"
|
||||||
|
@ -46,10 +46,7 @@ pub fn SiteHeader() -> impl IntoView {
|
||||||
match_value(pattern, value.split_at(1).1.to_string())
|
match_value(pattern, value.split_at(1).1.to_string())
|
||||||
}
|
}
|
||||||
search_all_options.with_value(|options| {
|
search_all_options.with_value(|options| {
|
||||||
let search_value = search_value
|
let search_value = search_value.to_lowercase().replace([' ', '-'], "");
|
||||||
.to_lowercase()
|
|
||||||
.replace(" ", "")
|
|
||||||
.replace("-", "");
|
|
||||||
let search_value = if search_value.len() > 20 {
|
let search_value = if search_value.len() > 20 {
|
||||||
search_value.split_at(20).0
|
search_value.split_at(20).0
|
||||||
} else {
|
} else {
|
||||||
|
@ -58,11 +55,7 @@ pub fn SiteHeader() -> impl IntoView {
|
||||||
options
|
options
|
||||||
.iter()
|
.iter()
|
||||||
.filter(|option| {
|
.filter(|option| {
|
||||||
let label = option
|
let label = option.label.to_lowercase().replace([' ', '-'], "");
|
||||||
.label
|
|
||||||
.to_lowercase()
|
|
||||||
.replace(" ", "")
|
|
||||||
.replace("-", "");
|
|
||||||
match_value(search_value, label)
|
match_value(search_value, label)
|
||||||
})
|
})
|
||||||
.cloned()
|
.cloned()
|
||||||
|
@ -140,24 +133,18 @@ fn gen_search_all_options() -> Vec<AutoCompleteOption> {
|
||||||
use crate::pages::{gen_guide_menu_data, gen_menu_data};
|
use crate::pages::{gen_guide_menu_data, gen_menu_data};
|
||||||
let mut options: Vec<_> = gen_menu_data()
|
let mut options: Vec<_> = gen_menu_data()
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(|group| {
|
.flat_map(|group| {
|
||||||
group.children.into_iter().map(|item| AutoCompleteOption {
|
group.children.into_iter().map(|item| AutoCompleteOption {
|
||||||
value: format!("/components/{}", item.value),
|
value: format!("/components/{}", item.value),
|
||||||
label: item.label,
|
label: item.label,
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
.flatten()
|
|
||||||
.collect();
|
.collect();
|
||||||
options.extend(
|
options.extend(gen_guide_menu_data().into_iter().flat_map(|group| {
|
||||||
gen_guide_menu_data()
|
group.children.into_iter().map(|item| AutoCompleteOption {
|
||||||
.into_iter()
|
value: format!("/guide/{}", item.value),
|
||||||
.map(|group| {
|
label: item.label,
|
||||||
group.children.into_iter().map(|item| AutoCompleteOption {
|
})
|
||||||
value: format!("/guide/{}", item.value),
|
}));
|
||||||
label: item.label,
|
|
||||||
})
|
|
||||||
})
|
|
||||||
.flatten(),
|
|
||||||
);
|
|
||||||
options
|
options
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
use crate::components::{Demo, DemoCode};
|
use crate::components::{Demo, DemoCode};
|
||||||
use leptos::*;
|
use leptos::*;
|
||||||
use thaw::*;
|
|
||||||
use prisms::highlight_str;
|
use prisms::highlight_str;
|
||||||
|
use thaw::*;
|
||||||
|
|
||||||
#[component]
|
#[component]
|
||||||
pub fn AlertPage() -> impl IntoView {
|
pub fn AlertPage() -> impl IntoView {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
use crate::components::{Demo, DemoCode};
|
use crate::components::{Demo, DemoCode};
|
||||||
use leptos::*;
|
use leptos::*;
|
||||||
use thaw::*;
|
|
||||||
use prisms::highlight_str;
|
use prisms::highlight_str;
|
||||||
|
use thaw::*;
|
||||||
|
|
||||||
#[component]
|
#[component]
|
||||||
pub fn AutoCompletePage() -> impl IntoView {
|
pub fn AutoCompletePage() -> impl IntoView {
|
||||||
|
|
Loading…
Add table
Reference in a new issue