Added basic song page structure and corresponding css file
This commit is contained in:
parent
7f58c4b68b
commit
b4bc605943
32
src/pages/songpage.rs
Normal file
32
src/pages/songpage.rs
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
#[component]
|
||||||
|
pub fn SongPage() -> impl IntoView {
|
||||||
|
let params = use_params_map();
|
||||||
|
|
||||||
|
view! {
|
||||||
|
<div class="song-container home-component">
|
||||||
|
{move || params.with(|params| {
|
||||||
|
match params.get("id").map(|id| id.parse::<i32>()) {
|
||||||
|
Some(Ok(id)) => {
|
||||||
|
view! { <SongDetails id /> }.into_view()
|
||||||
|
},
|
||||||
|
Some(Err(e)) => {
|
||||||
|
view! {
|
||||||
|
<Error<String>
|
||||||
|
title="Invalid Song ID"
|
||||||
|
error=e.to_string()
|
||||||
|
/>
|
||||||
|
}.into_view()
|
||||||
|
},
|
||||||
|
None => {
|
||||||
|
view! {
|
||||||
|
<Error<String>
|
||||||
|
title="No Song ID"
|
||||||
|
message="You must specify a song ID to view its page."
|
||||||
|
/>
|
||||||
|
}.into_view()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})}
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
}
|
0
style/song.scss
Normal file
0
style/song.scss
Normal file
Loading…
x
Reference in New Issue
Block a user