use more atomic styles for header/footer classes. use page url to determin class names

This commit is contained in:
captainill 2015-11-09 22:11:00 -08:00
parent b33c3fcd0d
commit ebec7e2bc2
5 changed files with 387 additions and 328 deletions

View File

@ -1,210 +1,88 @@
body.page-sub{
#footer-wrap{
background-color: white;
padding: 0 0 50px 0;
}
body.page-home{
#footer{ #footer{
margin-top: -40px; padding: 40px 0;
margin-top: 0;
} }
} }
#footer{ #footer{
padding: 140px 0 40px; background-color: white;
color: black; padding: 100px 0 60px;
margin-top: -40px;
a{ &.white{
color: black; background-color: $black;
.footer-links{
li > a {
@include project-footer-a-subpage-style();
}
}
} }
.footer-links{ .footer-links{
margin-bottom: 20px; li > a {
@include project-footer-a-style();
.li-under a:hover::after, }
.li-under a:focus::after {
opacity: 1;
-webkit-transform: skewY(15deg) translateY(8px);
-moz-transform: skewY(15deg) translateY(8px);
transform: skewY(15deg) translateY(8px);
} }
.li-under a::after { .hashicorp-project{
background-color: $purple; margin-top: 24px;
} }
li{ .pull-right{
padding-right: 15px;
}
}
.edit-page-link{
position: absolute;
top: -70px;
right: 30px;;
a{ a{
text-transform: uppercase; text-transform: uppercase;
font-size: 12px; color: $black;
letter-spacing: 3px; font-size: 13px;
@include transition( color 0.3s ease );
font-weight: 400;
&:hover{
color: $purple;
@include transition( color 0.3s ease );
background-color: transparent;
}
}
}
}
.buttons.navbar-nav{
float: none;
display: inline-block;
margin-bottom: 30px;
margin-top: 0px;
li{
&.first{
margin-right: 12px;
}
&.download{
a{
background: image-url('icon-download-purple.png') 8px 6px no-repeat;
@include img-retina("icon-download-purple.png", "icon-download-purple@2x.png", 20px, 20px);
}
}
&.github{
a{
background: image-url('icon-github-purple.png') 8px 6px no-repeat;
@include img-retina("icon-github-purple.png", "icon-github-purple@2x.png", 20px, 20px);
}
}
}
li > a {
padding-top: 6px;
padding-bottom: 6px;
padding-left: 40px;
}
}
.footer-hashi{
float: right;
padding-top: 5px;
letter-spacing: 2px;
a{
color: black;
font-weight: $font-weight-lato-xb;
}
span{
margin-right: 10px;
}
.hashi-logo{
display: inline-block;
vertical-align: middle;
i{
display: inline-block;
width: 37px;
height: 40px;
background: image-url('footer-hashicorp-logo.png') 0 0 no-repeat;
@include img-retina("footer-hashicorp-logo.png", "footer-hashicorp-logo@2x.png", 37px, 40px);
}
}
}
}
.page-sub{
#footer-wrap{
padding: 0;
}
#footer{
padding: 140px 0 100px;
background-color: $black;
transform: none;
>.container{
transform: none;
}
a{
color: white;
}
.footer-hashi{
color: white;
.hashi-logo{
i{
background: image-url('footer-hashicorp-white-logo.png') 0 0 no-repeat;
@include img-retina("footer-hashicorp-white-logo.png", "footer-hashicorp-white-logo@2x.png", 37px, 40px);
}
}
}
}
}
@media (min-width: 1500px) {
body.page-home{
#footer{
margin-top: -60px;
padding: 190px 0 40px;
}
} }
} }
@media (max-width: 992px) { @media (max-width: 992px) {
.page-sub #footer, #footer{ .footer-links {
.footer-hashi { display: block;
padding-top: 14px;
span{
margin-right: 6px;
}
.hashi-logo{
i{
margin-top: -6px;
width: 20px;
height: 22px;
background-size: 20px 22px;
}
}
}
}
}
@media (max-width: 768px) {
#footer{
padding: 100px 0 40px;
text-align: center; text-align: center;
.footer-links{ ul{
float: none; display: inline-block;;
display: inline-block; float: none !important;
} }
.footer-hashi { .footer-hashi{
float: none; display: block;
display: inline-block;
.pull-right{
float: none !important; float: none !important;
} }
} }
}
} }
@media (max-width: 320px) { @media (max-width: 414px) {
#footer{ #footer{
text-align: center; ul{
display: block;
li{
display: block;
float: none;
}
.footer-links{ &.external-links{
.li-under{ li{
float: none !important; svg{
position: relative;
left: 0;
top: 2px;
margin-top: 0;
margin-right: 4px;
}
}
} }
} }
} }
} }

View File

@ -4,33 +4,21 @@
// - Edits should not be made here // - Edits should not be made here
// -------------------------------------------------- // --------------------------------------------------
#header { #header{
position: relative; position: relative;
margin-bottom: 0;
}
.navigation {
color: black; color: black;
text-rendering: optimizeLegibility; text-rendering: optimizeLegibility;
margin-bottom: 0;
transition: all 1s ease; transition: all 1s ease;
&.white{ &.white{
color: white;
.navbar-brand { .navbar-brand {
.logo { .logo {
color: white; color: white;
} }
.by{
color: white;
font-weight: 300;
svg{
path,
polygon{
fill: white;
}
line{
stroke: white;
}
}
}
} }
.main-links, .main-links,
@ -41,38 +29,104 @@
} }
} }
} }
.nav > li > a:hover, .nav > li > a:focus {
color: white;
} }
.navbar-header{ &.black{
.navbar-toggle{ .navbar-brand {
.icon-bar{ .logo {
border: 1px solid white; color: black;
} }
} }
.main-links,
.external-links {
li > a {
color: black;
}
} }
} }
.navbar-header{
.navbar-toggle{ .navbar-toggle{
height: $header-height; height: $header-height;
margin: 0; margin: 0;
padding-right: 15px;
border-radius: 0; border-radius: 0;
.icon-bar{ .icon-bar{
border: 1px solid $black; border: 1px solid $black;
border-radius: 0; border-radius: 0;
} }
} }
.external-links {
&.white{
svg path{
fill: $white;
}
} }
.navbar-brand { li {
position: relative;
svg path{
@include transition( all 300ms ease-in );
}
&:hover{
svg path{
@include transition( all 300ms ease-in );
}
}
@include project-svg-external-links-style();
&.download{
margin-right: 10px;
}
> a {
padding-left: 12px !important;
svg{
position: absolute;
left: -12px;
top: 50%;
margin-top: -7px;
width: 14px;
height: 14px;
}
}
}
}
.main-links{
margin-right: $nav-margin-right * 2;
}
.main-links,
.external-links {
&.white{
li > a {
color: white;
}
}
li > a {
@include hashi-a-style();
margin: 0 10px;
padding-top: 1px;
line-height: $header-height;
@include project-a-style();
}
}
.nav > li > a:hover, .nav > li > a:focus {
background-color: transparent;
@include transition( all 300ms ease-in );
}
}
.navbar-brand {
display: block; display: block;
height: $header-height; height: $header-height;
padding: 0; padding: 0;
margin: 0 10px 0 0 ; margin: 0 10px 0 0;
.logo{ .logo{
display: inline-block; display: inline-block;
@ -89,8 +143,17 @@
text-decoration: none; text-decoration: none;
} }
} }
}
.by{ .navbar-toggle{
&.white{
.icon-bar{
border: 1px solid white;
}
}
}
.by-hashicorp{
display: inline-block; display: inline-block;
vertical-align:top; vertical-align:top;
height: $header-height; height: $header-height;
@ -103,6 +166,31 @@
font-size: 0; font-size: 0;
text-decoration: none; text-decoration: none;
&.white{
color: white;
font-weight: 300;
svg{
path,
polygon{
fill: white;
}
line{
stroke: white;
}
}
&:focus,
&:hover{
text-decoration: none;
color: white;
}
}
&:focus,
&:hover{
text-decoration: none;
}
.svg-wrap{ .svg-wrap{
font-size: 13px; font-size: 13px;
} }
@ -140,70 +228,97 @@
} }
} }
} }
}
.hashicorp-project{
display: inline-block;
height: 30px;
line-height: 30px;
text-decoration: none;
font-size: 14px;
color: $black;
font-weight: 600;
&.white{
color: white;
svg{
path,
polygon{
fill: white;
}
line{
stroke: white;
}
} }
} }
.external-links { &:focus{
li { text-decoration: none;
position: relative;
svg path{
@include transition( all 300ms ease-in );
} }
&:hover{ &:hover{
svg path{ text-decoration: none;
@include transition( all 300ms ease-in );
}
}
&.download{
margin-right: 10px;
}
> a {
padding-left: 12px !important;
svg{ svg{
position: absolute; &.svg-by{
left: -12px; line{
top: 50%; stroke: $purple;
margin-top: -7px;
width: 14px;
height: 14px;
} }
} }
} }
} }
span{
margin-right: 4px;
font-family: $header-font-family;
font-weight: 500;
}
span,
svg{
display: inline-block;
}
svg{
&.svg-by{
width: $by-hashicorp-width;
height: $by-hashicorp-height;
margin-bottom: -4px;
margin-left: -3px;
}
&.svg-logo{
width: 30px;
height: 30px;
margin-bottom: -10px;
margin-left: -1px;
}
path,
line{
fill: $black;
@include transition(all 300ms ease-in);
&:hover{
@include transition(all 300ms ease-in);
}
}
}
}
@media (max-width: 480px) {
.navigation {
.main-links{ .main-links{
margin-right: $nav-margin-right * 2; margin-right: 0;
} }
.main-links,
.external-links {
li > a {
@include hashi-a-style();
margin: 0 10px;
padding-top: 1px;
line-height: $header-height;
}
}
.nav > li > a:hover, .nav > li > a:focus {
background-color: transparent;
color: $black;
@include transition( all 300ms ease-in );
} }
} }
@media (max-width: 414px) { @media (max-width: 414px) {
#header { #header {
.navbar-header{
.navbar-toggle{ .navbar-toggle{
padding-top: 10px; padding-top: 10px;
height: $header-mobile-height; height: $header-mobile-height;
} }
}
.navbar-brand { .navbar-brand {
height: $header-mobile-height; height: $header-mobile-height;
@ -212,7 +327,7 @@
height: $header-mobile-height; height: $header-mobile-height;
line-height: $header-mobile-height; line-height: $header-mobile-height;
} }
.by{ .by-hashicorp{
height: $header-mobile-height; height: $header-mobile-height;
line-height: $header-mobile-height; line-height: $header-mobile-height;
padding-top: 0; padding-top: 0;

View File

@ -16,5 +16,56 @@ $project-logo-pad-left: 8px;
&:hover{ &:hover{
color: $white; color: $white;
opacity: 1;
}
}
@mixin project-footer-a-style{
color: $black;
font-weight: 400;
&:hover{
color: $purple;
svg path{
fill: $purple;
}
}
}
@mixin project-footer-a-subpage-style{
color: $white;
font-weight: 400;
svg path{
fill: $white;
}
&:hover{
color: $purple;
svg path{
fill: $purple;
}
}
}
@mixin project-svg-external-links-style{
svg path{
fill: $black;
}
&:hover{
svg path{
fill: $blue;
}
}
}
@mixin project-by-hashicorp-style{
&:hover{
line{
stroke: $blue;
}
} }
} }

View File

@ -1,28 +1,43 @@
<div class="skew-item" id="footer-wrap"> <div class="skew-item ">
<div id="footer"> <div id="footer" class="navigation <%= current_page.url == "/" ? "black" : "white" %>">
<div class="container"> <div class="container">
<div class="row"> <div class="row">
<div class="footer-links col-sm-7 col-xs-12"> <div class="col-xs-12">
<ul class="footer-links nav navbar-nav">
<li class="li-under"><a href="/intro/index.html">Intro</a></li>
<li class="active li-under"><a href="/docs/index.html">Docs</a></li>
<li class="li-under"><a href="/community.html">Community</a></li>
<% if current_page.url != '/' %> <% if current_page.url != '/' %>
<li class="li-under"><a href="<%= github_url :current_page %>">Edit this page</a></li> <div class="edit-page-link"><a href="<%= github_url :current_page %>">Edit this page</a></div>
<% end %> <% end %>
<div class="footer-links">
<ul class="main-links nav navbar-nav">
<li><a href="/intro/index.html">Intro</a></li>
<li><a href="/docs/index.html">Docs</a></li>
<li><a href="/community.html">Community</a></li>
<li><a href="/security.html">Security</a></li>
</ul> </ul>
</div> <ul class="external-links nav navbar-nav">
<div class="footer-hashi col-sm-5 col-xs-12"> <li class="first download">
<div class="pull-right"> <a href="/downloads.html"><%= partial "layouts/svg/svg-download" %>Download</a>
<span>Copyright &copy; <%= Time.now.year %>. A <a href="https://www.hashicorp.com">HashiCorp</a> Project.</span> </li>
<a class="hashi-logo" href="https://www.hashicorp.com"><i class="hashi-logo"></i></a> <li class="github">
<a href="https://github.com/hashicorp/terraform"><%= partial "layouts/svg/svg-github" %>GitHub</a>
</li>
</ul>
</ div>
<div class="footer-hashi pull-right">
<div class="">
<a class="hashicorp-project <%= current_page.url == "/" ? "black" : "white" %>" href="https://www.hashicorp.com">
<span class="project-text">A </span>
<%= partial "layouts/svg/svg-by-hashicorp" %>
<span class="project-text">Project</span>
<%= partial "layouts/svg/svg-hashicorp-logo" %>
</a>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<div class="skew-item" id="footer-bg"></div> <div class="skew-item" id="footer-bg"></div>
</div> </div>
</div> </div>
</div>
</div> </div>
<script> <script>

View File

@ -1,11 +1,11 @@
<div id="header" class="white <%= current_page.data.page_title == "home" ? "" : "navbar-static-top" %>"> <div id="header" class="navigation white <%= current_page.data.page_title == "home" ? "" : "navbar-static-top" %>">
<div class="container"> <div class="container">
<div class="row"> <div class="row">
<div class="col-xs-12"> <div class="col-xs-12">
<div class="navbar-header"> <div class="navbar-header">
<div class="navbar-brand"> <div class="navbar-brand">
<a class="logo" href="/">Terraform</a> <a class="logo" href="/">Terraform</a>
<a class="by" href="https://hashicorp.com/"><span class="svg-wrap">by</span><%= partial "layouts/svg/svg-by-hashicorp" %><%= partial "layouts/svg/svg-hashicorp-logo" %>Hashicorp</a> <a class="by-hashicorp white" href="https://hashicorp.com/"><span class="svg-wrap">by</span><%= partial "layouts/svg/svg-by-hashicorp" %><%= partial "layouts/svg/svg-hashicorp-logo" %>Hashicorp</a>
</div> </div>
<button class="navbar-toggle" type="button"> <button class="navbar-toggle" type="button">
<span class="sr-only">Toggle navigation</span> <span class="sr-only">Toggle navigation</span>
@ -15,7 +15,7 @@
</button> </button>
</div> </div>
<div class="buttons hidden-xs"> <div class="buttons hidden-xs">
<nav role="navigation"> <nav class="navigation-links" role="navigation">
<ul class="external-links nav navbar-nav navbar-right"> <ul class="external-links nav navbar-nav navbar-right">
<li class="first download"> <li class="first download">
<a href="/downloads.html"><%= partial "layouts/svg/svg-download" %>Download</a> <a href="/downloads.html"><%= partial "layouts/svg/svg-download" %>Download</a>