Make Responsive (#33)
* Responsive home page * Make post page responsive * Fix coloring in dark theme * Visibility toggle in a better way * Fixes * Remove newlines * Minor fixes Co-authored-by: Yash Mehrotra <yashmehrotra95@gmail.com>
This commit is contained in:
@@ -9,6 +9,8 @@
|
|||||||
<h3>{{ .Site.Params.Description }}</h3>
|
<h3>{{ .Site.Params.Description }}</h3>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
|
<div class="flex-break"></div>
|
||||||
|
|
||||||
{{ if isset .Site.Params "showpostsonhomepage" }}
|
{{ if isset .Site.Params "showpostsonhomepage" }}
|
||||||
|
|
||||||
<div class="home-posts list-posts">
|
<div class="home-posts list-posts">
|
||||||
|
|||||||
@@ -29,6 +29,28 @@
|
|||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="nav-link" id="hamburger-menu-toggle">
|
||||||
|
<a>
|
||||||
|
<span data-feather="menu"></span>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- For mobile -->
|
||||||
|
<ul class="nav-hamburger-list visibility-hidden">
|
||||||
|
{{ range .Site.Menus.main }}
|
||||||
|
<li class="nav-item">
|
||||||
|
<a href="{{ .URL }}">
|
||||||
|
{{- .Pre | safeHTML }} {{ .Name }} {{ .Post | safeHTML -}}
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
{{ end }}
|
||||||
|
<li class="nav-item">
|
||||||
|
<a id="dark-theme-toggle">
|
||||||
|
<span id="theme-toggle-icon" data-feather="moon"></span>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</nav>
|
</nav>
|
||||||
</header>
|
</header>
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<article class="post-title">
|
<article class="post-title">
|
||||||
<a href="{{ .RelPermalink }}" class="post-link">{{ .Title }}</a>
|
<a href="{{ .RelPermalink }}" class="post-link">{{ .Title }}</a>
|
||||||
|
<div class="flex-break"></div>
|
||||||
<span class="post-date">{{ dateFormat "January 2, 2006" .Date }}</span>
|
<span class="post-date">{{ dateFormat "January 2, 2006" .Date }}</span>
|
||||||
</article>
|
</article>
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
<h1 class="list-title">{{ .Name }}</h2>
|
<h1 class="list-title">{{ .Name }}</h2>
|
||||||
|
|
||||||
{{ range (where .Site.Pages "Params.type" "post" ).GroupByDate "2006" }}
|
{{ range (where .Pages "Params.type" "post" ).GroupByDate "2006" }}
|
||||||
|
|
||||||
<h2 class="posts-year">{{ .Key }}</h2>
|
<h2 class="posts-year">{{ .Key }}</h2>
|
||||||
|
|
||||||
|
|||||||
@@ -16,6 +16,10 @@ html {
|
|||||||
background-color: var(--dark-header-bg-color);
|
background-color: var(--dark-header-bg-color);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.nav-hamburger-list {
|
||||||
|
background: var(--dark-header-bg-color);
|
||||||
|
}
|
||||||
|
|
||||||
.nav-links .nav-icons-divider {
|
.nav-links .nav-icons-divider {
|
||||||
color: var(--dark-header-divider-color);
|
color: var(--dark-header-divider-color);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,13 +42,12 @@ img {
|
|||||||
|
|
||||||
/* HEADER */
|
/* HEADER */
|
||||||
.header {
|
.header {
|
||||||
background-color: var(--light-header-bg-color);
|
background-color: rgba(240, 240, 240, 0.95);
|
||||||
box-shadow: rgba(170, 170, 170, 0.5) 0px 1px 2px 0px;
|
box-shadow: rgba(170, 170, 170, 0.5) 0px 1px 2px 0px;
|
||||||
color: inherit;
|
color: inherit;
|
||||||
font-size: 1.05rem;
|
font-size: 1.05rem;
|
||||||
height: 50px;
|
height: 50px;
|
||||||
left: 0;
|
left: 0;
|
||||||
opacity: 0.95;
|
|
||||||
position: fixed;
|
position: fixed;
|
||||||
top: 0;
|
top: 0;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
@@ -117,6 +116,31 @@ img {
|
|||||||
stroke-linejoin: round;
|
stroke-linejoin: round;
|
||||||
width: 24px;
|
width: 24px;
|
||||||
}
|
}
|
||||||
|
#hamburger-menu-toggle {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
#hamburger-menu-toggle .feather {
|
||||||
|
height: 24px;
|
||||||
|
stroke-linecap: round;
|
||||||
|
stroke-linejoin: round;
|
||||||
|
width: 24px;
|
||||||
|
}
|
||||||
|
.nav-hamburger-list {
|
||||||
|
background: var(--light-header-bg-color);
|
||||||
|
border-bottom: solid 1.5px var(--light-header-divider-color);
|
||||||
|
border-top: solid 1.5px var(--light-header-divider-color);
|
||||||
|
list-style-type: none;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
position: absolute;
|
||||||
|
right: 0;
|
||||||
|
text-align: center;
|
||||||
|
width: 100%;
|
||||||
|
z-index: 5;
|
||||||
|
}
|
||||||
|
.nav-hamburger-list a:hover {
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
|
||||||
/* FOOTER */
|
/* FOOTER */
|
||||||
.footer {
|
.footer {
|
||||||
@@ -143,6 +167,16 @@ img {
|
|||||||
|
|
||||||
/** COMMON **/
|
/** COMMON **/
|
||||||
|
|
||||||
|
.flex-break {
|
||||||
|
flex-basis: 100%;
|
||||||
|
height: 0;
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.visibility-hidden {
|
||||||
|
visibility: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
/* ICONS */
|
/* ICONS */
|
||||||
.feather {
|
.feather {
|
||||||
height: 20px;
|
height: 20px;
|
||||||
@@ -185,6 +219,7 @@ pre {
|
|||||||
|
|
||||||
pre {
|
pre {
|
||||||
font-size: 0.95rem;
|
font-size: 0.95rem;
|
||||||
|
overflow: scroll;
|
||||||
padding: 20px;
|
padding: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -205,6 +240,8 @@ table {
|
|||||||
font-size: 1.05rem;
|
font-size: 1.05rem;
|
||||||
margin: 30px 0;
|
margin: 30px 0;
|
||||||
text-align: left;
|
text-align: left;
|
||||||
|
display: block;
|
||||||
|
overflow-x: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
table thead {
|
table thead {
|
||||||
@@ -316,3 +353,52 @@ main#content .post {
|
|||||||
opacity: 0.8;
|
opacity: 0.8;
|
||||||
padding: 6px;
|
padding: 6px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@media only screen and (max-width: 820px) {
|
||||||
|
body {
|
||||||
|
font-size: 0.95rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.flex-break {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.home-about .avatar img {
|
||||||
|
border-radius: 50%;
|
||||||
|
height: 7rem;
|
||||||
|
width: 7rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.nav-links .nav-link,
|
||||||
|
.nav-icons-divider {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
#hamburger-menu-toggle {
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
|
||||||
|
main#content {
|
||||||
|
box-sizing: border-box;
|
||||||
|
padding: 0 1.5rem;
|
||||||
|
width: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
main#content .post {
|
||||||
|
font-size: 1.05rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.home-about {
|
||||||
|
margin: 0 auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.list-posts {
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media only screen and (min-width: 820px) {
|
||||||
|
.nav-hamburger-list {
|
||||||
|
visibility: hidden !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -23,6 +23,15 @@ function ready() {
|
|||||||
setTheme('dark');
|
setTheme('dark');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
document.getElementById('hamburger-menu-toggle').addEventListener('click', () => {
|
||||||
|
const hamburgerMenu = document.getElementsByClassName('nav-hamburger-list')[0]
|
||||||
|
if (hamburgerMenu.classList.contains('visibility-hidden')) {
|
||||||
|
hamburgerMenu.classList.remove('visibility-hidden');
|
||||||
|
} else {
|
||||||
|
hamburgerMenu.classList.add('visibility-hidden');
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
function setTheme(themeToSet) {
|
function setTheme(themeToSet) {
|
||||||
|
|||||||
Reference in New Issue
Block a user