Created page music
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
pub(crate) mod files;
|
pub(crate) mod files;
|
||||||
|
pub(crate) mod music;
|
||||||
pub(crate) mod projects;
|
pub(crate) mod projects;
|
||||||
|
|
||||||
use crate::html::elements::{Heading, Link};
|
use crate::html::elements::{Heading, Link};
|
||||||
|
|||||||
54
src/pages/music.rs
Normal file
54
src/pages/music.rs
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
use crate::html::layouts::DivisionBuilder;
|
||||||
|
use crate::html::pages::BasePageBuilder;
|
||||||
|
use crate::html::{Render, boxed_vec};
|
||||||
|
|
||||||
|
use crate::AppState;
|
||||||
|
use crate::html::elements::{HeadingBuilder, IframeBuilder, Link};
|
||||||
|
use actix_web::web::Data;
|
||||||
|
use actix_web::{Responder, get, web};
|
||||||
|
use sqlx::query_as;
|
||||||
|
|
||||||
|
#[get("/music")]
|
||||||
|
async fn music(state: Data<AppState>) -> impl Responder {
|
||||||
|
let featured_title = HeadingBuilder::new()
|
||||||
|
.level(1)
|
||||||
|
.text("The song I've been listening to the most recently is \"Hot\" by Avril Lavigne.")
|
||||||
|
.build();
|
||||||
|
let featured_iframe = IframeBuilder::new()
|
||||||
|
.src("https://www.youtube.com/embed/fzb75m8NuMQ")
|
||||||
|
.build();
|
||||||
|
let featured = DivisionBuilder::new()
|
||||||
|
.classes(vec!["featured"])
|
||||||
|
.id("featured")
|
||||||
|
.elements(boxed_vec![featured_title, featured_iframe])
|
||||||
|
.build();
|
||||||
|
|
||||||
|
let playlist_title = HeadingBuilder::new()
|
||||||
|
.text(
|
||||||
|
"You can find below my primary playlist, \
|
||||||
|
the one containing almost all the songs I have been listening to throughout the years.",
|
||||||
|
)
|
||||||
|
.build();
|
||||||
|
let playlist_iframe = IframeBuilder::new()
|
||||||
|
.src(
|
||||||
|
"https://open.spotify.com/embed/playlist/\
|
||||||
|
3owjyc1RILDGkgCmdCal39?utm_source=generator",
|
||||||
|
)
|
||||||
|
.build();
|
||||||
|
let playlist = DivisionBuilder::new()
|
||||||
|
.id("playlist")
|
||||||
|
.classes(vec!["playlist"])
|
||||||
|
.elements(boxed_vec![playlist_title, playlist_iframe])
|
||||||
|
.build();
|
||||||
|
|
||||||
|
let css = Link::builder()
|
||||||
|
.rel("stylesheet")
|
||||||
|
.href("/static/css/music.css")
|
||||||
|
.build();
|
||||||
|
let page = BasePageBuilder::new()
|
||||||
|
.title("Music")
|
||||||
|
.head(boxed_vec![css])
|
||||||
|
.body(boxed_vec![featured, playlist])
|
||||||
|
.build();
|
||||||
|
page.render()
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user