diff options
author | Darshan Baral <darshanbaral@gmail.com> | 2020-01-14 03:15:46 +0300 |
---|---|---|
committer | Darshan Baral <darshanbaral@gmail.com> | 2020-01-14 03:15:46 +0300 |
commit | 640d7913d40cf6826b33fee59390c8b8ef927a48 (patch) | |
tree | d93b6ee850c363cdff2e8f77af9f2075815aca6a /layouts | |
parent | 6f56ec8ed401bc79c3e83897eb63f4db9864df15 (diff) |
Theme toggler is in menu now
Diffstat (limited to 'layouts')
-rw-r--r-- | layouts/partials/header.html | 11 | ||||
-rw-r--r-- | layouts/partials/toggleTheme.html | 15 |
2 files changed, 17 insertions, 9 deletions
diff --git a/layouts/partials/header.html b/layouts/partials/header.html new file mode 100644 index 0000000..83361bd --- /dev/null +++ b/layouts/partials/header.html @@ -0,0 +1,11 @@ +<div class="d-flex flex-row justify-content-between align-items-center mt-2"> +<div class="d-flex flex-row row"> + <h3 class="main-menu mr-3"> + <a href="{{ .Site.BaseURL }}">Home</a> + </h3> + <h3 class="main-menu mr-3"> + <a href="{{ "blog" | relURL }}">Blog</a> + </h3> +</div> +{{ partial "toggleTheme" . }} +</div>
\ No newline at end of file diff --git a/layouts/partials/toggleTheme.html b/layouts/partials/toggleTheme.html index f71cfee..eb437c2 100644 --- a/layouts/partials/toggleTheme.html +++ b/layouts/partials/toggleTheme.html @@ -9,21 +9,18 @@ </div> <script> - const mainTheme = - "{{ print (`/css/aafu_` | relURL) .Site.Params.theme.mainTheme `.css` }}"; - const altTheme = - "{{ print (`/css/aafu_` | relURL) .Site.Params.theme.altTheme `.css` }}"; + //const mainTheme = + // "{{ print (`/css/aafu_` | relURL) .Site.Params.theme.mainTheme `.css` }}"; + //const altTheme = + // "{{ print (`/css/aafu_` | relURL) .Site.Params.theme.altTheme `.css` }}"; const currentCSS = document.querySelector("#color-CSS"); function toggleTheme(elem) { //console.log("." + mainTheme); //console.log(altTheme); elem.classList.toggle("fa-toggle-off"); elem.classList.toggle("fa-toggle-on"); - if (currentCSS.href.includes(mainTheme)) { - currentCSS.setAttribute("href", "." + altTheme); - } else { - currentCSS.setAttribute("href", "." + mainTheme); - } + currentTheme = currentTheme === mainTheme ? altTheme : mainTheme; + foo(currentTheme); } function changeThemeColor() { |