The styles I copied from Refills are in a new Sass partial of course. In “source/stylesheets/all.sass” we reference:
- @import 'header_navbar'
- .centered-navigation {
- $base-border-radius: 3px !default;
- $dark-gray: #333 !default;
- $large-screen: em(860) !default;
- $base-font-color: white;
- $centered-navigation-padding: 1em;
- $centered-navigation-logo-height: 2em;
- $centered-navigation-background: #E7F1EC;
- $centered-navigation-color: $base-font-color;
- $centered-navigation-color-hover: $text-color;
- $centered-navigation-height: 60px;
- $centered-navigation-item-padding: 1em;
- $centered-navigation-submenu-padding: 1em;
- $centered-navigation-item-nudge: 2.2em;
- $horizontal-bar-mode: $large-screen;
- background-color: $matcha-green;
- border-bottom: 1px solid darken($matcha-green, 5%);
- min-height: $centered-navigation-height;
- width: 100%;
- z-index: 9999;
- // Mobile view
- .mobile-logo {
- display: inline;
- float: left;
- max-height: $centered-navigation-height;
- padding-left: $centered-navigation-padding;
- img {
- max-height: $centered-navigation-height;
- padding: .8em 0;
- }
- @include media($horizontal-bar-mode) {
- display: none;
- }
- }
- .centered-navigation-mobile-menu {
- color: $centered-navigation-color;
- display: block;
- float: right;
- line-height: $centered-navigation-height;
- margin: 0;
- padding-right: $centered-navigation-submenu-padding;
- text-decoration: none;
- text-transform: uppercase;
- @include media ($horizontal-bar-mode) {
- display: none;
- }
- &:focus,
- &:hover {
- color: $centered-navigation-color-hover;
- }
- }
- // Nav menu
- .centered-navigation-wrapper {
- @include outer-container;
- @include clearfix;
- position: relative;
- z-index: 999;
- }
- ul.centered-navigation-menu {
- -webkit-transform-style: preserve-3d; // stop webkit flicker
- clear: both;
- display: none;
- margin: 0 auto;
- overflow: visible;
- padding: 0;
- width: 100%;
- z-index: 99999;
- &.show {
- display: block;
- }
- @include media ($horizontal-bar-mode) {
- display: block;
- text-align: center;
- }
- }
- // The nav items
- .nav-link:first-child {
- @include media($horizontal-bar-mode) {
- margin-left: $centered-navigation-item-nudge;
- padding-right: 0px;
- }
- }
- ul li.nav-link {
- background: lighten($matcha-green, 8%);
- display: block;
- line-height: $centered-navigation-height;
- overflow: hidden;
- padding-right: $centered-navigation-submenu-padding;
- text-align: right;
- width: 100%;
- z-index: 9999;
- a {
- color: $centered-navigation-color;
- display: inline-block;
- outline: none;
- text-decoration: none;
- &:focus,
- &:hover {
- color: $centered-navigation-color-hover;
- }
- }
- @include media($horizontal-bar-mode) {
- background: transparent;
- display: inline;
- line-height: $centered-navigation-height;
- a {
- padding-right: $centered-navigation-item-padding;
- }
- }
- }
- li.logo.nav-link {
- display: none;
- line-height: 0;
- @include media($large-screen) {
- display: inline;
- }
- }
- .logo img {
- margin-bottom: -$centered-navigation-logo-height / 3;
- max-height: $centered-navigation-logo-height;
- }
- }
- //= require jquery
- $(document).ready ->
- menuToggle = $('#js-centered-navigation-mobile-menu').unbind()
- $('#js-centered-navigation-menu').removeClass 'show'
- menuToggle.on 'click', (e) ->
- e.preventDefault()
- $('#js-centered-navigation-menu').slideToggle ->
- if $('#js-centered-navigation-menu').is(':hidden')
- $('#js-centered-navigation-menu').removeAttr 'style'
- return
- return
- return
![]() |
Here’s the index page:
![]() |
![]() |
- git add --all
- git commit -m 'Implements a header with navbar
- Adds header partial to layout
- Takes care of deployed asset url for logo
- Imports Sass partial for navbar
- Adds logo
- Adds CoffeeScript code
- Adjusts Refills styles
- Adjusts Refills markup'
- middleman deploy
The next change is a small one, just a touch really. We need to update the title tag in our layout (“source/layouts/layout.erb”):
- <title>Matcha Nerdz<%= ' - ' + current_article.title unless current_article.nil? %></title>
- git add --all
- git commit -m 'Adjusts site’s title'
- middleman deploy
When you look at the bottom of the index list of articles you’ll see something essential missing—navigating our list of posts.
![]() |
- blog.paginate = true
- ---
- per_page: 10
- pageable: true
- ---
- <!--
- <% if paginate && num_pages > 1 %>
- <p>Page <%= page_number %> of <%= num_pages %></p>
- <% if prev_page %>
- <p><%= link_to 'Previous page', prev_page %></p>
- <% end %>
- <% end %>
- -->
- <% if paginate %>
- <% if prev_page %>
- <p class='pagination-link'><%= link_to '<< Previous page', prev_page %></p>
- <% end %>
- <% if next_page %>
- <p class='pagination-link'><%= link_to 'Next page >>', next_page %></p>
- <% end %>
- <% end %>
- @import 'pagination'
- .pagination-link
- +shift(2)
- margin-bottom: 4em
- &:first-of-type
- float: left
- margin-right: 4em
- a
- +transition(color 0.25s ease-in-out)
- color: $text-color
- font-size: 1.1em
- &:hover
- color: $matcha-green
![]() |
![]() |
- git add -all
- git commit -m 'Adds Pagination to index list of posts
- Adjusts config.rb
- Adjusts markup on index page
- Adds styles in _pagination Sass partial'
- middleman deploy
I guess that should suffice for version 01! As a next step, you should play with media queries to make the layout responsive to various screen sizes. The typography could need some serious love as well.
Pick a typface or two that best goes with the theme of your podcast—just don’t forget to keep it super readable.
Also, should you decide to do a podcast for real, I can only congratulate you. It’s a great way to learn from experts and also to increase your network significantly. Doing something of value for the community is always a good idea and can pay off big time. One last tip, try to learn by doing and experiement as much as you can! Reading alone just doesn’t cut it—been there, done that! If you like to share the lessions learned by writing about it, you will deepen your understanding of the topic even more. Have fun!
Written by Ed Wassermann
If you found this post interesting, follow and support us.
Suggest for you:
Learn Responsive Web Development from Scratch
The Complete Web Developer Course - Build 14 Websites
Create Complete Web Apps without Coding
The Complete PHP 7 Guide for Web Developers
Advanced HTML5 Tutorial for Web Developers






No comments:
Post a Comment