diff options
author | Darshan Baral <darshanbaral@gmail.com> | 2020-01-14 03:16:37 +0300 |
---|---|---|
committer | Darshan Baral <darshanbaral@gmail.com> | 2020-01-14 03:16:37 +0300 |
commit | b43e1fb339a8bbd3af779e53578793179c72c90f (patch) | |
tree | d143eb16502f91d217eb2f01716e957ebe289dde | |
parent | 640d7913d40cf6826b33fee59390c8b8ef927a48 (diff) |
Added blogs and modified onload function for theme toggle
-rw-r--r-- | layouts/_default/baseof.html | 3 | ||||
-rw-r--r-- | layouts/_default/list.html | 22 | ||||
-rw-r--r-- | layouts/_default/single.html | 9 | ||||
-rw-r--r-- | layouts/index.html | 8 | ||||
-rw-r--r-- | layouts/partials/head.html | 46 |
5 files changed, 76 insertions, 12 deletions
diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index e95279e..0e1ac85 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -1,7 +1,8 @@ <!DOCTYPE html> <html lang="{{ .Site.LanguageCode }}"> {{- partial "head.html" . -}} - <body class="container" style="max-width: 1400px;"> + <body class="container"> + {{ partial "header" . }} {{- block "main" . }} {{- end }} </body> diff --git a/layouts/_default/list.html b/layouts/_default/list.html new file mode 100644 index 0000000..79a98f1 --- /dev/null +++ b/layouts/_default/list.html @@ -0,0 +1,22 @@ +{{ define "main" }} +<h1 class="standard top-h1 mt-4 mb-4"> + {{- .Title -}} +</h1> +<div class="standard grid-container"> + {{ range (.Paginator 2).Pages }} + <div class="index-box p-3 shadow rounded mb-4"> + <p class="mb-0">{{ .Date.Format "January 2, 2006" }}</p> + <h3> + <a href="{{ .Permalink | relURL }}"> + {{- .Title -}} + </a> + </h3> + + <p>Reading Time: {{ .ReadingTime }} minutes</p> + </div> + {{ end }} +</div> +<div class="mt-4 d-flex justify-content-center"> + {{ template "_internal/pagination.html" . }} +</div> +{{ end }} diff --git a/layouts/_default/single.html b/layouts/_default/single.html new file mode 100644 index 0000000..bd08166 --- /dev/null +++ b/layouts/_default/single.html @@ -0,0 +1,9 @@ +{{ define "main" }} + +<h1 class="top-h1"> + {{- .Title -}} +</h1> +<div class="border p-2 rounded"> + {{ .Content }} +</div> +{{ end }} diff --git a/layouts/index.html b/layouts/index.html index 04d3ac4..a69bfd6 100644 --- a/layouts/index.html +++ b/layouts/index.html @@ -1,17 +1,15 @@ {{ define "main" }}
<div class="ml-auto mr-auto row row-eq-height rounded">
<div class="col-md-5 text-center p-2 mt-3">
- <div class="profile-area rounded text-center position-relative">
- {{ partial "toggleTheme" . }}
+ <div class="profile-area rounded text-center position-relative shadow">
{{ partial "profilePhoto" . }}
<div class="p-2">
- {{ partial "social" . }}
- {{ partial "footer" . }}
+ {{ partial "social" . }} {{ partial "footer" . }}
</div>
</div>
</div>
<div class="col-md-7 pt-2 mt-3">
- {{ range .Site.Params.showInAccordion }}
+ {{ range .Site.Params.showInAccordion }}
<h2 class="accordion {{ if .expand }} active {{ end }}">
{{ $current := index $.Site.Params .item }}
<span onclick="expandAccordion(this)" style="cursor: pointer;">
diff --git a/layouts/partials/head.html b/layouts/partials/head.html index 6e71286..8f37803 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -20,17 +20,51 @@ href="//fonts.googleapis.com/css?family=Didact+Gothic%7CRoboto:400%7CRoboto+Mono"
/>
- <link
- id="color-CSS"
- rel="stylesheet"
- href="{{ print `/css/aafu_` .Site.Params.theme.mainTheme `.css` | relURL }}"
- type="text/css"
- />
<link rel="stylesheet" href="{{ `/css/aafu.css` | relURL }}" />
<script>
+ const colors = {
+ light: {
+ primaryBg: "#f8f9fa",
+ primaryText: "black",
+ primaryLinks: "#007bff",
+ secondaryBg: "#fff",
+ secondaryText: "black",
+ secondaryLinks: "#007bff",
+ shadow: "#595659"
+ },
+ dark: {
+ primaryBg: "#2c2b2b",
+ primaryText: "white",
+ primaryLinks: "#ffc107",
+ secondaryBg: "#373737",
+ secondaryText: "white",
+ secondaryLinks: "#ffc107",
+ shadow: "black"
+ },
+ pinkish: {
+ primaryBg: "#f8f9fa",
+ primaryText: "black",
+ primaryLinks: "#81415f",
+ secondaryBg: "#81415f",
+ secondaryText: "white",
+ secondaryLinks: "#ffc107",
+ shadow: "#595659"
+ }
+ };
+ const mainTheme = {{ .Site.Params.theme.mainTheme }};
+ let currentTheme = mainTheme;
+ const altTheme = {{ .Site.Params.theme.altTheme }};
+ const foo = (theme) => {
+ let thisTheme = colors[theme];
+ Object.keys(thisTheme).forEach(function(key) {
+ document.documentElement.style.setProperty(`--${key}`, thisTheme[key]);
+ });
+ };
var themeColor = document.querySelector("meta[name=theme-color]");
window.onload = function() {
+ foo(currentTheme);
+ const root = document.documentElement;
themeColor.content = getComputedStyle(document.body)["background-color"];
let defaultActivePanel = document.querySelector(".accordion.active")
.nextElementSibling;
|