Updated pages to use the changed html elements
This commit is contained in:
@@ -6,33 +6,38 @@ use crate::html::{Page, Render};
|
||||
use actix_web::{Responder, get};
|
||||
|
||||
pub(crate) struct BasePage {
|
||||
page: Page
|
||||
page: Page,
|
||||
}
|
||||
|
||||
impl BasePage {
|
||||
pub(crate) fn new(title: &'static str) -> Self {
|
||||
pub(crate) fn new<T>(title: T) -> Self
|
||||
where
|
||||
T: Into<String>,
|
||||
{
|
||||
let mut page = Page::new(title);
|
||||
// header
|
||||
let mut header = div::new("header", vec!["header"]);
|
||||
let name = p::new("name", vec!["name"], "AINDUSTRIES".to_string());
|
||||
let name = p::new("name", vec!["name"], "AINDUSTRIES");
|
||||
let mut buttons = div::new("buttons", vec!["nav-buttons"]);
|
||||
let home = a::new("home", vec!["nav-button"], "/", "Home".to_string());
|
||||
let projects = a::new("projects", vec!["nav-button"], "/projects", "Projects".to_string());
|
||||
let home = a::new("home", vec!["nav-button"], "/", "Home");
|
||||
let projects = a::new("projects", vec!["nav-button"], "/projects", "Projects");
|
||||
buttons.append_element(home);
|
||||
buttons.append_element(projects);
|
||||
header.append_element(name);
|
||||
header.append_element(buttons);
|
||||
// background
|
||||
let image = img::new("background", vec!["background"], "static/img/background.png");
|
||||
let image = img::new(
|
||||
"background",
|
||||
vec!["background"],
|
||||
"/static/img/background.png",
|
||||
);
|
||||
// css
|
||||
let base = link::new("stylesheet", "static/css/base.css");
|
||||
let base = link::new("stylesheet", "/static/css/base.css");
|
||||
// add elements to the page in order
|
||||
page.append_element_to_head(base);
|
||||
page.append_element_to_body(image);
|
||||
page.append_element_to_body(header);
|
||||
Self {
|
||||
page
|
||||
}
|
||||
Self { page }
|
||||
}
|
||||
|
||||
pub(crate) fn append_element_to_head(&mut self, element: impl Render + 'static) {
|
||||
@@ -54,10 +59,12 @@ async fn index() -> impl Responder {
|
||||
let mut page = BasePage::new("AINDUSTRIES");
|
||||
// introduction
|
||||
let mut intro = div::new("intro", vec!["intro"]);
|
||||
let hi = h1::new("Hello and welcome!".to_string());
|
||||
let detail = h2::new("This here is a small website to show the passion I have for computers.<br>\
|
||||
let hi = h1::new("Hello and welcome!");
|
||||
let detail = h2::new(
|
||||
"This here is a small website to show the passion I have for computers.<br>\
|
||||
I have always had a good time creating and discovering new things.<br>\
|
||||
Your may discover some of my projects here on this showcase.".to_string());
|
||||
Your may discover some of my projects here on this showcase.",
|
||||
);
|
||||
intro.append_element(hi);
|
||||
intro.append_element(detail);
|
||||
// css
|
||||
|
||||
Reference in New Issue
Block a user