A Pen by Edward Lance Lorilla on CodePen.
Created
October 7, 2017 17:09
-
-
Save edwardlorilla/c6c3d6297861298b8ffb8779bd4409d2 to your computer and use it in GitHub Desktop.
eGRppV
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div id="app"> | |
<a class="skip-link screen-reader-text" href="#content">Skip to content</a> | |
<div class="outer-wrap"> | |
<header class="masthead"> | |
<div class="sidebar-switcher">Select layout: | |
<a @click="mainAreaToggle" :class="sidebar == 0 ? 'sidebar-left-toggle' : 'sidebar-right-toggle'"><i :class="sidebar == 0 ? 'fa-align-left' : 'fa-align-right'" class="fa"></i><span class="screen-reader-text">Move sidebar to the left</span></a> | |
<a href="#" class="no-sidebar-toggle"><i class="fa fa-align-justify"></i><span class="screen-reader-text">Remove sidebar</span></a> | |
<a @click="hideSideBarToggle" class="hide-sidebar-toggle"><i class="fa fa-arrow-circle-right"></i><span class="screen-reader-text">Remove sidebar</span> | |
</a></div><!-- .sidebar-switcher --> | |
<div class="centered"> | |
<div class="site-branding"> | |
<h1 class="site-title">Flexbox Demo: Holy Grail Layouts</h1> | |
</div><!-- .site-title --> | |
</div><!-- .centered --> | |
<nav class="main-menu"> | |
The menu would go here | |
</nav> | |
</header><!-- .masthead --> | |
<div class="content"> | |
<main class="main-area" :style="mainToggle"> | |
<article class="post-content"> | |
<h2>One of my favourite movies</h2> | |
<p>Lorem ipsum dolor sit amet consectetur, adipisicing elit. Rerum enim doloremque eaque nam rem obcaecati. Pariatur officia ex enim natus impedit, animi obcaecati qui at id sint alias, dicta illum?</p> | |
</article> | |
</main> | |
<div :class="hideSideBar" class="sidebar" :style="sidebarToggle"> | |
<div class="squish-container"> | |
<h3>Explore the Demos:</h3> | |
<nav class="example-menu"> | |
<ul> | |
<li><a href="menus.html">Flexbox Menus</a></li> | |
<li><a href="card-layout.html">Card Layout</a></li> | |
<li><a href="holy-grail.html">Holy Grail</a></li> | |
<li><a href="all-togehter.html">All Together Now</a></li> | |
</ul> | |
</nav><!-- .example-menu --> | |
</div> | |
</div><!-- .sidebar --> | |
</div><!-- .content --> | |
<footer class="footer-area"> | |
<p>The footer usually appears on the bottom of the page. That's why it's called the "footer".</p> | |
</footer> | |
</div><!-- .outer-wrap --> | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
new Vue({ | |
el: '#app', | |
data:{ | |
sidebar: 0, | |
mainArea: 1, | |
hideSideBar: 'hide' | |
}, | |
computed:{ | |
mainToggle:function(){ | |
return { | |
'order': this.mainArea | |
} | |
}, | |
sidebarToggle:function(){ | |
return { | |
'order' : this.sidebar | |
} | |
} | |
}, | |
methods:{ | |
hideSideBarToggle: function(){ | |
var vm = this | |
vm.hideSideBar == 'hide' ? vm.hideSideBar = '' : vm.hideSideBar = 'hide' | |
}, | |
mainAreaToggle:function(){ | |
console.log('hi') | |
var vm = this; | |
if(vm.sidebar == 1){ | |
vm.sidebar = 0; | |
}else{ | |
vm.sidebar = 1; | |
} | |
if(vm.mainArea == 1){ | |
vm.mainArea = 0; | |
}else{ | |
vm.mainArea =1; | |
} | |
} | |
} | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.3.4/vue.min.js"></script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*-------------------------------------------------------------- | |
Accessibility | |
--------------------------------------------------------------*/ | |
/* Text meant only for screen readers */ | |
.screen-reader-text { | |
clip: rect(1px, 1px, 1px, 1px); | |
position: absolute !important; | |
height: 1px; | |
width: 1px; | |
overflow: hidden; | |
} | |
.screen-reader-text:hover, | |
.screen-reader-text:active, | |
.screen-reader-text:focus { | |
background-color: #f1f1f1; | |
border-radius: 3px; | |
box-shadow: 0 0 2px 2px rgba(0, 0, 0, 0.6); | |
clip: auto !important; | |
color: #21759b; | |
display: block; | |
font-size: 14px; | |
font-weight: bold; | |
height: auto; | |
left: 5px; | |
line-height: normal; | |
padding: 15px 23px 14px; | |
text-decoration: none; | |
top: 5px; | |
width: auto; | |
z-index: 100000; /* Above WP toolbar */ | |
} | |
/* Base styles */ | |
.site-title { | |
margin-bottom: 0; | |
} | |
.main-menu { | |
padding: .4em 1em; | |
color: white; | |
background: hsl(0, 0%, 20%); | |
} | |
.post-content { | |
padding: 0 1.4em 1.4em; | |
} | |
.sidebar { | |
padding: .5em 1.4em 1em; | |
background: hsl(0, 0%, 90%); | |
} | |
.example-menu ul { | |
list-style-type: none; | |
margin: 0; | |
padding: 0; | |
} | |
.example-menu a { | |
display: block; | |
padding: .4em 0; | |
color: inherit; | |
text-decoration: none; | |
transition: all 0.5s ease; | |
} | |
.example-menu a:hover, | |
.example-menu a:focus { | |
padding: .4em 1em; | |
background: hsl(0, 0%, 20%); | |
color: white; | |
} | |
.footer-area { | |
padding: .4em 1em; | |
text-align: center; | |
background: hsl(0, 0%, 75%); | |
} | |
/* Flexbox stuff */ | |
@media screen and (min-width: 40em) { | |
.outer-wrap { | |
display: flex; | |
flex-direction: column; | |
} | |
.content { | |
display: flex; | |
} | |
.main-area { | |
flex: 1 1 auto; | |
} | |
.post-content { | |
max-width: 40em; | |
margin: 0 auto; | |
} | |
.sidebar { | |
flex: 0 0 12em; | |
order: 2; | |
transition: padding .5s ease, flex .5s ease, color .2s ease-in .3s; | |
} | |
.sidebar-left { | |
order: 0; | |
} | |
.no-sidebar { | |
flex-direction: column; | |
} | |
.hide { | |
padding: 0; | |
color: hsla(0, 0%, 0%, 0); | |
transition: color .2s ease, flex .5s ease .3s, padding .5s ease .3s; | |
} | |
.hide a { | |
color: hsla(0, 0%, 0%, 0); | |
} | |
} | |
/*-------------------------------------------------------------- | |
Layouts | |
--------------------------------------------------------------*/ | |
.centered { | |
margin: 0 auto; | |
padding: 0 1em; | |
} | |
@media screen and (min-width: 52em) { | |
.centered { | |
max-width: 52em; | |
} | |
} | |
/* Sidebar switcher buttons */ | |
@media screen and (max-width: 40em) { | |
/* Hide switcher on small screens */ | |
.sidebar-switcher { | |
display: none; | |
} | |
} | |
@media screen and (min-width: 40em) { | |
.sidebar-switcher { | |
position: absolute; | |
right: 0; | |
padding: .4em 1em; | |
color: hsl(0, 0%, 40%); | |
} | |
.sidebar-switcher a { | |
color: hsl(0, 0%, 40%); | |
padding-left: .4em; | |
} | |
.sidebar-switcher a:hover, | |
.sidebar-switcher a:focus { | |
color: hsl(0, 0%, 20%); | |
} | |
} | |
/*-------------------------------------------------------------- | |
Header styles minus menu | |
--------------------------------------------------------------*/ | |
.masthead { | |
background: hsl(0, 0%, 90%); | |
} | |
.site-title { | |
margin: 0 0 1em; | |
padding: 1em 0; | |
font-size: 2em; | |
font-weight: 300; | |
text-align: center; | |
color: black; | |
} | |
@media screen and (min-width: 44.44em) { | |
.site-title { | |
font-size: 2em; | |
} | |
} | |
@media screen and (min-width: 50em) { | |
.site-title { | |
font-size: 2.5em; | |
} | |
} | |
.site-title a { | |
color: hsl(5, 45%, 95%); | |
text-decoration: none; | |
} | |
.site-title a:hover { | |
text-decoration: underline; | |
} | |
/*-------------------------------------------------------------- | |
Typography | |
--------------------------------------------------------------*/ | |
body, | |
button, | |
input, | |
select, | |
textarea { | |
color: #404040; | |
font-family: 'Helvetica', Arial, sans-serif; | |
font-size: 18px; | |
line-height: 1.5; | |
} | |
h1, | |
h2, | |
h3, | |
h4, | |
h5, | |
h6 { | |
clear: both; | |
} | |
p { | |
margin-bottom: 1.5em; | |
} | |
b, | |
strong { | |
font-weight: bold; | |
} | |
dfn, | |
cite, | |
em, | |
i { | |
font-style: italic; | |
} | |
blockquote { | |
margin: 0 1.5em; | |
} | |
address { | |
margin: 0 0 1.5em; | |
} | |
pre { | |
background: #eee; | |
font-family: "Courier 10 Pitch", Courier, monospace; | |
font-size: 15px; | |
font-size: 1.5rem; | |
line-height: 1.6; | |
margin-bottom: 1.6em; | |
max-width: 100%; | |
overflow: auto; | |
padding: 1.6em; | |
} | |
code, | |
kbd, | |
tt, | |
var { | |
font: 15px Monaco, Consolas, "Andale Mono", "DejaVu Sans Mono", monospace; | |
} | |
abbr, | |
acronym { | |
border-bottom: 1px dotted #666; | |
cursor: help; | |
} | |
mark, | |
ins { | |
background: #fff9c0; | |
text-decoration: none; | |
} | |
sup, | |
sub { | |
font-size: 75%; | |
height: 0; | |
line-height: 0; | |
position: relative; | |
vertical-align: baseline; | |
} | |
sup { | |
bottom: 1ex; | |
} | |
sub { | |
top: .5ex; | |
} | |
small { | |
font-size: 75%; | |
} | |
big { | |
font-size: 125%; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" /> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment