Skip to content

Commit

Permalink
Merge pull request #2 from languageconvo/Vadim_May_dev
Browse files Browse the repository at this point in the history
Tag dropdown, fixed empty space mobile navbar
  • Loading branch information
KayakinKoder authored Mar 24, 2020
2 parents ff5af1e + 14b298c commit cac0ccd
Show file tree
Hide file tree
Showing 6 changed files with 101 additions and 11 deletions.
2 changes: 1 addition & 1 deletion assets/built/screen.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion assets/built/screen.css.map

Large diffs are not rendered by default.

51 changes: 43 additions & 8 deletions assets/css/screen.css
Original file line number Diff line number Diff line change
Expand Up @@ -153,21 +153,22 @@ body {
.site-header-content {
z-index: 100;
display: flex;
flex-direction: column;
flex-direction: row;
justify-content: center;
align-items: center;
padding: 6vw 3vw;
min-height: 200px;
max-height: 340px;
flex-wrap: wrap;
}

.site-title {
z-index: 10;
margin: 63px 0 -2px 0;
margin: 63px 0 20px;
padding: 0;
font-size: 5.0rem;
line-height: 1em;
font-weight: 600;
font-weight: 400;
}

.site-logo {
Expand Down Expand Up @@ -197,17 +198,40 @@ body {

/* padding for the homepage header */
.site-home-header .site-header-content {
padding: 130px 55px 40px 55px;
padding: 60px 0px 40px;
}

.site-home-header .site-title {
font-size: 5.5rem;
text-align: center;
text-align: start;
flex: 1 0 100%;
}

.site-home-header .site-description {
font-size: 2.2rem;
font-weight: 300;
flex: 0 1 80%;
}
.home-template .site-header-content>.tags{
padding: 8px 5px;
}
.site-header-content > .tags {
flex: 0 1 20%;
background-color: #edf1ea;
border: none;
border-radius: .6rem;
padding: 5px;
transition: all .5s ease-in-out;
}
/* fix for IE */
.site-header-content >.tags::-ms-expand {
display: none;
}

.site-header-content >.tags:focus {
outline: 0;
border-color: #eff2eb;
box-shadow: 0 0 0 3px rgba(0, 121, 250, .3);
}


Expand Down Expand Up @@ -617,13 +641,17 @@ The knock-on effect of this is ugly browser-scroll bars at the bottom, so 80px o
.site-nav-right {
position: fixed;
margin:0;
top:203px; /*for now*/
top:185px; /*Empty space fix */
background: #fff no-repeat 50%;
width: 100%;
left: 0;
justify-content: center;

}
/* adjust paddings of menu items to main site*/
.nav li a{
padding: 0.8rem 0;
}

}

Expand Down Expand Up @@ -954,8 +982,15 @@ make sure this only happens on large viewports / desktop-ish devices.
font-size: 1.6rem;
}
}


/* 6.1 Tag template
/* ---------------------------------------------------------- */
.tag-template .site-title {
flex: 1 0 100%;
margin: 20px 0;
}
.tag-template .site-description {
flex: 0 1 80%;
}
/* 7. Single Post
/* ---------------------------------------------------------- */

Expand Down
24 changes: 23 additions & 1 deletion index.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ into the {body} of the default.hbs template --}}
<div class="inner">
{{> "site-nav"}}
<div class="site-header-content">
<!-- removed title -->
<h1 class="site-title">{{@site.title}}</h1>
<h2 class="site-description">{{@site.description}}</h2>
{{> "site-tags"}}
</div>
</div>
</div>
Expand All @@ -34,4 +35,25 @@ into the {body} of the default.hbs template --}}

{{!-- The #contentFor helper here will send everything inside it up to the matching #block helper found in default.hbs --}}
{{#contentFor "scripts"}}
<script>
const select = document.querySelector(".tags");
const options = document.querySelectorAll(".tags option");
// 1
select.addEventListener("change", function() {
let url = this.options[this.selectedIndex].dataset.url;
if(url) {
location.href = url;
}
});
// 2
for(const option of options) {
let url = option.dataset.url;
if(location.pathname.includes(url)) {
option.setAttribute("selected", "");
break;
}
}
</script>
{{/contentFor}}
8 changes: 8 additions & 0 deletions partials/site-tags.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{{#get "tags" limit="all"}}
<select class="tags">
<option data-url="{{@site.url}}">Blog Home</option>
{{#foreach tags}}
<option data-url="{{url}}" >{{name}}</option>
{{/foreach}}
</select>
{{/get}}
25 changes: 25 additions & 0 deletions tag.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
A collection of {{plural ../pagination.total empty='posts' singular='% post' plural='% posts'}}
{{/if}}
</h2>
{{> "site-tags"}}
</div>
</div>
</header>
Expand All @@ -30,3 +31,27 @@
</div>
</div>
</main>
{{!-- The #contentFor helper here will send everything inside it up to the matching #block helper found in default.hbs --}}
{{#contentFor "scripts"}}
<script>
const select = document.querySelector(".tags");
const options = document.querySelectorAll(".tags option");
// 1
select.addEventListener("change", function() {
let url = this.options[this.selectedIndex].dataset.url;
if(url) {
location.href = url;
}
});
// 2
for(const option of options) {
let url = option.dataset.url;
if(location.pathname.includes(url)) {
option.setAttribute("selected", true);
break;
}
}
</script>
{{/contentFor}}

0 comments on commit cac0ccd

Please sign in to comment.