background_color_class = "bg-black" | background_color_class = "bg-black" | ||||
featured_image = "/images/gohugo-default-sample-hero-image.jpg" | featured_image = "/images/gohugo-default-sample-hero-image.jpg" | ||||
recent_posts_number = 2 | recent_posts_number = 2 | ||||
# TODO: integrate into build procedure | |||||
custom_css = ["dist/css/hamburger-menu.css"] |
<nav class="pv3 ph3 ph4-ns" role="navigation"> | <nav class="pv3 ph3 ph4-ns" role="navigation"> | ||||
<div class="flex-l justify-between items-center center"> | <div class="flex-l justify-between items-center center"> | ||||
<a href="{{ .Site.Home.RelPermalink }}" class="f3 fw2 hover-white no-underline white-90 dib"> | |||||
<a href="{{ .Site.Home.RelPermalink }}" class="site-logo f3 fw2 hover-white no-underline white-90 dib"> | |||||
{{ with .Site.Params.site_logo }} | {{ with .Site.Params.site_logo }} | ||||
<img src="{{ . }}" class="w100 mw5-ns" alt="{{ $.Site.Title }}" /> | <img src="{{ . }}" class="w100 mw5-ns" alt="{{ $.Site.Title }}" /> | ||||
{{ else }} | {{ else }} | ||||
{{ .Site.Title }} | {{ .Site.Title }} | ||||
{{ end }} | {{ end }} | ||||
</a> | </a> | ||||
<div class="flex-l items-center"> | |||||
<div class="main-menu-container flex-l items-center"> | |||||
{{ partial "i18nlist.html" . }} | {{ partial "i18nlist.html" . }} | ||||
{{ if .Site.Menus.main }} | {{ if .Site.Menus.main }} | ||||
<ul class="pl0 mr3"> | |||||
<input class="main-menu-button" type="checkbox" id="main-menu-button" /> | |||||
<label class="main-menu-label" for="main-menu-button"><span class="main-menu-icon"></span></label> | |||||
<ul class="main-menu-list" class="pl0 mr3"> | |||||
{{ range .Site.Menus.main }} | {{ range .Site.Menus.main }} | ||||
<li class="list f5 f4-ns fw4 dib pr3"> | <li class="list f5 f4-ns fw4 dib pr3"> | ||||
<a class="hover-white no-underline white-90" href="{{ .URL }}" title="{{ .Name }} page"> | <a class="hover-white no-underline white-90" href="{{ .URL }}" title="{{ .Name }} page"> | ||||
{{ end }} | {{ end }} | ||||
</ul> | </ul> | ||||
{{ end }} | {{ end }} | ||||
{{ partialCached "social-follow.html" . }} | |||||
<div class="top-social-container"> | |||||
{{ partialCached "social-follow.html" . }} | |||||
</div> | |||||
</div> | </div> | ||||
</div> | </div> | ||||
</nav> | </nav> |
.main-menu-button { | |||||
display: none; | |||||
} | |||||
@media (max-width: 768px) { | |||||
/* hide social media links in mobile view */ | |||||
.top-social-container { | |||||
display: none | |||||
} | |||||
/* menu */ | |||||
.main-menu-list { | |||||
clear: both; | |||||
max-height: 0; | |||||
transition: max-height 0.2s ease-out; | |||||
} | |||||
/* menu icon: middle bar */ | |||||
.main-menu-icon, | |||||
.main-menu-icon:before, | |||||
.main-menu-icon:after { | |||||
background: lightblue; | |||||
display: block; | |||||
width: 30px; | |||||
content: ''; | |||||
transition-duration: 0.2s; | |||||
transition-timing-function: ease-out; | |||||
} | |||||
.main-menu-icon { | |||||
height: 3px; | |||||
position: relative; | |||||
transition-property: background; | |||||
} | |||||
/* menu icon: add one bar below and one above -> hamburger style */ | |||||
.main-menu-icon:before, | |||||
.main-menu-icon:after { | |||||
height: 100%; | |||||
position: absolute; | |||||
transition-property: all; | |||||
} | |||||
.main-menu-icon:before { top: 10px; } | |||||
.main-menu-icon:after { top: -10px; } | |||||
/* limit the length of the menu item list */ | |||||
.main-menu-button:checked ~ .main-menu-list { | |||||
max-height: 100%; | |||||
} | |||||
/* parallel -> crossing transition of hamburger menu icon */ | |||||
.main-menu-button:checked ~ .main-menu-label .main-menu-icon { background: transparent; } | |||||
.main-menu-button:checked ~ .main-menu-label .main-menu-icon:before { transform: rotate(-45deg); } | |||||
.main-menu-button:checked ~ .main-menu-label .main-menu-icon:after { transform: rotate(45deg); } | |||||
.main-menu-button:checked ~ .main-menu-label:not(.steps) .main-menu-icon:before, | |||||
.main-menu-button:checked ~ .main-menu-label:not(.steps) .main-menu-icon:after { | |||||
top: 0; | |||||
} | |||||
.main-menu-label { | |||||
display: inline-block; | |||||
cursor: pointer; | |||||
float: right; | |||||
padding: 28px 20px; | |||||
position: relative; | |||||
user-select: none; | |||||
} | |||||
.main-menu-list { | |||||
overflow: hidden; | |||||
} | |||||
.main-menu-list li { | |||||
display: block; | |||||
text-align: right; | |||||
padding: 0.5rem; | |||||
} | |||||
/* reduce width of logo and place logo and hamburger menu on one line */ | |||||
.site-logo { display: inline; } | |||||
.site-logo img { max-width: 70%; } | |||||
.main-menu-container { display: inline; } | |||||
} |