[Update] Blog: style blog page / featureposts

This commit is contained in:
0xfff 2016-11-05 16:24:20 +01:00
parent d6f33aebea
commit 3aa5989f2c
11 changed files with 132 additions and 49 deletions

View file

@ -12,7 +12,7 @@ exclude:
- Gemfile - Gemfile
- Gemfile.lock - Gemfile.lock
- package.json - package.json
paginate: 5 paginate: 12
paginate_path: "/blog/page:num/" paginate_path: "/blog/page:num/"
name: Dash name: Dash
url: https://www.dash.org url: https://www.dash.org
@ -53,5 +53,4 @@ srcset:
source: assets/img source: assets/img
output: assets/img/resized output: assets/img/resized
keep_files: keep_files: ['assets/img/resized']
- 'assets/img/resized'

View file

@ -10,7 +10,7 @@
<!-- Hero content --> <!-- Hero content -->
<div class="hero__content"> <div class="hero__content">
<a href="#">Blog — General</a><!-- TODO --> <a href="{{ basenav }}/blog/">{% t nav.blog %}{% if page.categories | size == 1 %} {{ page.categories | first }}{% if page.categories | size > 1 %}{% for category in page.categories offset: 1 %} / {{ category }} {% endfor %} {% endif %}{% endif %}</a><!-- TODO: Add category page and link to it -->
<h1 class="hero__title">{% if page.title %}{{ page.title }}{% endif %}</h1> <h1 class="hero__title">{% if page.title %}{{ page.title }}{% endif %}</h1>
<p class="hero__lead">{{ page.date | date: "%b %d, %Y" }}</p> <p class="hero__lead">{{ page.date | date: "%b %d, %Y" }}</p>
</div> </div>

View file

@ -1,21 +1,21 @@
{% if paginator.total_pages > 1 %} {% if paginator.total_pages > 1 %}
<div class="pagination"> <div class="pagination">
{% if paginator.previous_page %} {% if paginator.previous_page %}
<a href="{{ paginator.previous_page_path | prepend: site.baseurl | replace: '//', '/' }}">&laquo; Prev</a> <a href="{{ paginator.previous_page_path | prepend: site.baseurl | replace: '//', '/' }}" class="pagination__prev">&laquo; Prev</a>
{% endif %} {% endif %}
{% for page in (1..paginator.total_pages) %} {% for page in (1..paginator.total_pages) %}
{% if page == paginator.page %} {% if page == paginator.page %}
<em>{{ page }}</em> <em class="pagination__current">{{ page }}</em>
{% elsif page == 1 %} {% elsif page == 1 %}
<a href="/blog">{{ page }}</a> <a href="/blog" class="pagination__link pagination__link--start">{{ page }}</a>
{% else %} {% else %}
<a href="{{ site.paginate_path | prepend: site.baseurl | replace: '//', '/' | replace: ':num', page }}">{{ page }}</a> <a href="{{ site.paginate_path | prepend: site.baseurl | replace: '//', '/' | replace: ':num', page }}" class="pagination__link">{{ page }}</a>
{% endif %} {% endif %}
{% endfor %} {% endfor %}
{% if paginator.next_page %} {% if paginator.next_page %}
<a href="{{ paginator.next_page_path | prepend: site.baseurl | replace: '//', '/' }}">Next &raquo;</a> <a href="{{ paginator.next_page_path | prepend: site.baseurl | replace: '//', '/' }}" class="pagination__next">Next &raquo;</a>
{% endif %} {% endif %}
</div> </div>
{% endif %} {% endif %}

View file

@ -6,31 +6,32 @@ description: pages.blog.description
{% include hero/blog.html %} {% include hero/blog.html %}
<div class="content post"> <div class="page page--blog">
<div class="single-col">
{% include pagination_navigation_all.html %}
<section class="section">
<div class="section__content content">
<div class="featurepost-grid">
{% for post in paginator.posts %} {% for post in paginator.posts %}
<!-- limit:4 --> <!-- limit:10 -->
<div class="feature"> <article class="featurepost">
<div class="featurepost__preview {% if post.image %}featurepost__preview--image{% else %}featurepost__preview--no-image{% endif %}">
{% if post.image %} {% if post.image %}
<img src="{{ post.image }}" class="preview"> <img src="{{ post.image }}" class="featurepost__image">
{% endif %} {% endif %}
<h2><a href="{{ post.url }}">{{ post.title }}</a></h2>
<p><em>{{ post.date | date: "%b %d, %Y" }}</em><br />{{ post.excerpt | strip_html | truncatewords: 50 }}</p>
</div> </div>
<span class="clear"></span>
<div class="divider"> <h2 class="featurepost__title"><a href="{{ post.url }}">{{ post.title }}</a></h2>
</div> <em class="featurepost__date">{{ post.date | date: "%b %d, %Y" }}</em>
<p class="featurepost__description">{{ post.excerpt | strip_html | truncatewords: 50 }}</p>
<div class="featurepost__divider"></div>
</article>
{% endfor %} {% endfor %}
</div>
{% include pagination_navigation_all.html %} {% include pagination_navigation_all.html %}
</div> </div>
</section>
</div> </div>

View file

@ -65,22 +65,11 @@
&__imagewrapper { &__imagewrapper {
background: rgba($color-blue-light, 0.1); background: rgba($color-blue-light, 0.1);
width: 100%; @include overflow-image-wrapper();
height: 0;
padding-bottom: 56.25%; // 16:9
position: relative;
overflow: hidden;
} }
&__image { &__image {
position: absolute; @include overflow-image();
top: 50%;
transform: translateY(-50%);
left: 0;
right: 0;
bottom: 0;
width: 100%;
height: auto;
} }
&__title { &__title {

View file

@ -0,0 +1,61 @@
$m: 'featurepost';
.#{$m} {
display: inline-block;
vertical-align: top;
padding: 0 pxToRem(20px);
margin-bottom: pxToRem(40px);
max-width: 500px;
margin-left: auto;
margin-right: auto;
overflow-wrap: break-word;
&__title {
@include font-title-medium();
margin-bottom: pxToRem(10px);
a {
color: $color-blue;
}
}
&__date {
display: inline-block;
margin-bottom: pxToRem(10px);
color: transparentize($color-black, 0.5);
}
&__divider {
}
&__preview {
@include overflow-image-wrapper();
background: rgba($color-blue, 0.1);
margin-bottom: pxToRem(40px);
&--no-image {
// Hide images until we actually have htem
padding-bottom: 1px;
}
}
&__image {
@include overflow-image();
}
}
// TODO: Move into separate module
.featurepost-grid {
margin: 0 pxToRem(-20px);
.featurepost {
display: block;
width: 100%;
@include mq($from: small) {
display: inline-block;
width: 49%;
}
@include mq($from: medium) {
width: 33%;
}
}
}

View file

@ -19,4 +19,8 @@ $m: 'page';
} }
&--participate { &--participate {
} }
&--blog {
}
} }

View file

@ -0,0 +1,8 @@
$m: 'pagination';
.#{$m} {
display: inline-block;
width: 100%;
text-align: center;
padding: pxToRem(40px) 0;
}

View file

@ -18,11 +18,6 @@
} }
} }
.pagination{
width:100%;
text-align: right;
}
.author{ .author{
width:100%; width:100%;
text-align: center; text-align: center;

View file

@ -1,3 +1,26 @@
/**
* Overflow Image (Content: Fit) 16/9
*
*/
@mixin overflow-image-wrapper {
width: 100%;
height: 0;
padding-bottom: 56.25%; // 16:9
position: relative;
overflow: hidden;
}
@mixin overflow-image {
position: absolute;
top: 50%;
transform: translateY(-50%);
left: 0;
right: 0;
bottom: 0;
width: 100%;
height: auto;
}
/** /**
* Hide visually * Hide visually
* *

View file

@ -20,7 +20,10 @@
@import "forms"; @import "forms";
@import "footer"; @import "footer";
@import "page"; @import "page";
@import "pagination";
@import "section"; @import "section";
@import "featurepost";
//stuff most pages need //stuff most pages need
@import "overlay-menu"; @import "overlay-menu";