mirror of
https://github.com/adoyle0/thaw.git
synced 2025-01-23 06:19:22 -05:00
feat(demo): remove regex
This commit is contained in:
parent
63007dc7c4
commit
17f909d861
2 changed files with 8 additions and 15 deletions
|
@ -13,7 +13,6 @@ icondata = { version = "0.0.7", features = [
|
||||||
"AiCheckOutlined",
|
"AiCheckOutlined",
|
||||||
] }
|
] }
|
||||||
leptos_router = { version = "0.5.1", features = ["csr"] }
|
leptos_router = { version = "0.5.1", features = ["csr"] }
|
||||||
regex = "1.8.2"
|
|
||||||
leptos_devtools = "0.0.1"
|
leptos_devtools = "0.0.1"
|
||||||
prisms = { git = "https://github.com/luoxiaozero/prisms" }
|
prisms = { git = "https://github.com/luoxiaozero/prisms" }
|
||||||
|
|
||||||
|
|
|
@ -2,25 +2,19 @@ use crate::components::SiteHeader;
|
||||||
use leptos::*;
|
use leptos::*;
|
||||||
use leptos_router::{use_location, use_navigate, Outlet};
|
use leptos_router::{use_location, use_navigate, Outlet};
|
||||||
use melt_ui::*;
|
use melt_ui::*;
|
||||||
use regex::Regex;
|
|
||||||
|
|
||||||
#[component]
|
#[component]
|
||||||
pub fn ComponentsPage() -> impl IntoView {
|
pub fn ComponentsPage() -> impl IntoView {
|
||||||
let loaction = use_location();
|
|
||||||
let navigate = use_navigate();
|
let navigate = use_navigate();
|
||||||
let selected = create_rw_signal(String::from(""));
|
let selected = create_rw_signal({
|
||||||
create_effect(move |_| {
|
let loaction = use_location();
|
||||||
let pathname = loaction.pathname.get();
|
let mut pathname = loaction.pathname.get_untracked();
|
||||||
|
|
||||||
let re = Regex::new(r"^/melt-ui/components/(.+)$").unwrap();
|
if pathname.starts_with("/melt-ui/components/") {
|
||||||
let Some(caps) = re.captures(&pathname) else {
|
pathname.drain(20..).collect()
|
||||||
return;
|
} else {
|
||||||
};
|
String::new()
|
||||||
let Some(path) = caps.get(1) else {
|
}
|
||||||
return;
|
|
||||||
};
|
|
||||||
let path = path.as_str().to_string();
|
|
||||||
selected.set(path);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
create_effect(move |value| {
|
create_effect(move |value| {
|
||||||
|
|
Loading…
Add table
Reference in a new issue