Also make website more mobile-friendly for smaller devices. And ignore
temporary scssc files from cache SCSS compiling.
This commit is contained in:
2020-07-27 00:18:42 +02:00
parent 272bd93ed8
commit 8b984e301f
3 changed files with 64 additions and 38 deletions

View File

@@ -43,25 +43,25 @@ final icons = {
// Get the current pages title
String getPageTitle() => querySelector('title').text;
// Create any type of icon
// Create the home button
Future<Element> makeHome() async {
return Element.li()
..classes.add('nav-item')
..insertAdjacentElement(
'afterBegin',
Element.a()
..attributes['href'] = '/'
..append(makeIcon(icons['home'])));
}
// Create a clickable icon
// `t_elem` must be an SVG declared in the above `icons` variable.
Element makeIcon(SvgElement t_elem) {
final icon = t_elem..classes.add('nav-icon');
return icon;
}
// Make the Table of Content in the navbar
Future<Element> makeToc() async {
return Element.li()
..attributes['id'] = 'toc-drop'
..attributes['tabindex'] = '0'
..classes.addAll(['nav-item', 'has-dropdown'])
..append(Element.a()
..attributes['tabindex'] = '-1'
..attributes['href'] = 'javascript:void(0)'
..append(makeIcon(icons['toc'])));
}
// Make the list of pages in the navbar
// Create the dropdown sitemap
Future<Element> makePages() async {
var pages = Element.ul()
..attributes['id'] = 'drop-page'
@@ -76,7 +76,7 @@ Future<Element> makePages() async {
..append(pages);
}
// Make the share icon
// Create the array of share icons
Future<Element> makeShare() async {
// Create a share button
Element makeShareLink(Element t_icon, String t_url) {
@@ -115,14 +115,12 @@ Future<Element> makeShare() async {
'https://www.facebook.com/sharer/sharer.php?u=${window.location.href}')));
}
// Make the theme changer in the navbar
// Create the theme changer
Future<Element> makeThemeChanger() async {
Element makeThemeItem(String t_btnId, String t_text, [Element t_icon]) {
Element makeThemeItem(String t_btnId, [Element t_icon]) {
return Element.li()
..classes.add('dropdown-item')
..append(Element.span()
..attributes['id'] = t_btnId
..appendText(' $t_text'));
..append(Element.span()..attributes['id'] = t_btnId);
}
return Element.li()
@@ -137,25 +135,29 @@ Future<Element> makeThemeChanger() async {
..append(Element.ul()
..classes.add('dropdown')
..attributes['id'] = 'theme-dropdown'
..append(makeThemeItem('lightBtn', 'Clair', makeIcon(icons['sun'])))
..append(makeThemeItem('darkBtn', 'Sombre', makeIcon(icons['lightbulb'])))
..append(makeThemeItem('blackBtn', 'Noir', makeIcon(icons['moon']))));
..append(makeThemeItem('lightBtn', makeIcon(icons['sun'])))
..append(makeThemeItem('darkBtn', makeIcon(icons['lightbulb'])))
..append(makeThemeItem('blackBtn', makeIcon(icons['moon']))));
}
// Make home button in navbar
Future<Element> makeHome() async {
// Create the dropdown table of contents
Future<Element> makeToc() async {
return Element.li()
..classes.add('nav-item')
..insertAdjacentElement(
'afterBegin',
Element.a()
..attributes['href'] = '/'
..append(makeIcon(icons['home'])));
..attributes['id'] = 'toc-drop'
..attributes['tabindex'] = '0'
..classes.addAll(['nav-item', 'has-dropdown'])
..append(Element.a()
..attributes['tabindex'] = '-1'
..attributes['href'] = 'javascript:void(0)'
..append(makeIcon(icons['toc'])));
}
// Add a navbar atop of the HTML body, containing two buttons:
// - One back to home
// - A dropdown to each page detected in the sitemap
// Add a navbar atop of the HTML body, containing:
// - A back to home button
// - A dropdown sitemap
// - A dropdown table of contents
// - A dropdown array of share icons
// - A theme changer
Future<Element> makeNavbar() async {
final navbar_content = Element.ul()..classes.add('navbar-nav');
final home = await makeHome();