<div class="grid">
<header class="header">
<i class="fas fa-bars header__menu"></i>
<div class="header__search">
<input class="header__input" placeholder="Search..." />
</div>
<div class="header__avatar">
<div class="dropdown">
<ul class="dropdown__list">
<li class="dropdown__list-item">
<span class="dropdown__icon"><i class="far fa-user"></i></span>
<span class="dropdown__title">my profile</span>
</li>
<li class="dropdown__list-item">
<span class="dropdown__icon"><i class="fas fa-clipboard-list"></i></span>
<span class="dropdown__title">my account</span>
</li>
<li class="dropdown__list-item">
<span class="dropdown__icon"><i class="fas fa-sign-out-alt"></i></span>
<span class="dropdown__title">log out</span>
</li>
</ul>
</div>
</div>
</header>
<aside class="sidenav">
<div class="sidenav__brand">
<i class="fas fa-feather-alt sidenav__brand-icon"></i>
<a class="sidenav__brand-link" href="#">Ux<span class="text-light">Pro</span></a>
<i class="fas fa-times sidenav__brand-close"></i>
</div>
<div class="sidenav__profile">
<div class="sidenav__profile-avatar"></div>
<div class="sidenav__profile-title text-light">Matthew H</div>
</div>
<div class="row row--align-v-center row--align-h-center">
<ul class="navList">
<li class="navList__heading">documents<i class="far fa-file-alt"></i></li>
<li>
<div class="navList__subheading row row--align-v-center">
<span class="navList__subheading-icon"><i class="fas fa-briefcase-medical"></i></span>
<span class="navList__subheading-title">insurance</span>
</div>
<ul class="subList subList--hidden">
<li class="subList__item">medical</li>
<li class="subList__item">vision</li>
<li class="subList__item">dental</li>
</ul>
</li>
<li>
<div class="navList__subheading row row--align-v-center">
<span class="navList__subheading-icon"><i class="fas fa-plane-departure"></i></span>
<span class="navList__subheading-title">travel</span>
</div>
<ul class="subList subList--hidden">
<li class="subList__item">domestic</li>
<li class="subList__item">foreign</li>
<li class="subList__item">misc</li>
</ul>
</li>
<li>
<div class="navList__subheading row row--align-v-center">
<span class="navList__subheading-icon"><i class="far fa-angry"></i></span>
<span class="navList__subheading-title">taxes</span>
</div>
<ul class="subList subList--hidden">
<li class="subList__item">current</li>
<li class="subList__item">archives</li>
</ul>
</li>
<li class="navList__heading">messages<i class="far fa-envelope"></i></li>
<li>
<div class="navList__subheading row row--align-v-center">
<span class="navList__subheading-icon"><i class="fas fa-envelope"></i></span>
<span class="navList__subheading-title">inbox</span>
</div>
<ul class="subList subList--hidden">
<li class="subList__item">primary</li>
<li class="subList__item">social</li>
<li class="subList__item">promotional</li>
</ul>
</li>
<li>
<div class="navList__subheading row row--align-v-center">
<span class="navList__subheading-icon"><i class="fas fa-eye"></i></span>
<span class="navList__subheading-title">unread</span>
</div>
<ul class="subList subList--hidden">
<li class="subList__item">primary</li>
<li class="subList__item">social</li>
<li class="subList__item">promotional</li>
</ul>
</li>
<li>
<div class="navList__subheading row row--align-v-center">
<span class="navList__subheading-icon"><i class="fas fa-book-open"></i></span>
<span class="navList__subheading-title">archives</span>
</div>
<ul class="subList subList--hidden">
<li class="subList__item">primary</li>
<li class="subList__item">social</li>
<li class="subList__item">promotional</li>
</ul>
</li>
<li class="navList__heading">photo album<i class="far fa-image"></i></li>
<li>
<div class="navList__subheading row row--align-v-center">
<span class="navList__subheading-icon"><i class="fas fa-mountain"></i></span>
<span class="navList__subheading-title">vacation</span>
</div>
<ul class="subList subList--hidden">
<li class="subList__item">cambodia</li>
<li class="subList__item">new york</li>
</ul>
</li>
<li>
<div class="navList__subheading row row--align-v-center">
<span class="navList__subheading-icon"><i class="fas fa-wine-glass-alt"></i></span>
<span class="navList__subheading-title">anniversary</span>
</div>
<ul class="subList subList--hidden">
<li class="subList__item">dive trip</li>
<li class="subList__item">hikathon</li>
<li class="subList__item">buffalo river</li>
</ul>
</li>
<li>
<div class="navList__subheading row row--align-v-center">
<span class="navList__subheading-icon"><i class="fas fa-graduation-cap"></i></span>
<span class="navList__subheading-title">university</span>
</div>
<ul class="subList subList--hidden">
<li class="subList__item">wild horse saloon</li>
<li class="subList__item">service corps</li>
<li class="subList__item">graduation</li>
<li class="subList__item">internships</li>
</ul>
</li>
<li class="navList__heading">statistics<i class="fas fa-chart-bar"></i></li>
<li>
<div class="navList__subheading row row--align-v-center">
<span class="navList__subheading-icon"><i class="fas fa-credit-card"></i></span>
<span class="navList__subheading-title">finances</span>
</div>
<ul class="subList subList--hidden">
<li class="subList__item">mortgage</li>
<li class="subList__item">investments</li>
<li class="subList__item">spend log</li>
<li class="subList__item">owed</li>
</ul>
</li>
<li>
<div class="navList__subheading row row--align-v-center">
<span class="navList__subheading-icon"><i class="fas fa-phone"></i></span>
<span class="navList__subheading-title">call stats</span>
</div>
<ul class="subList subList--hidden">
<li class="subList__item">last month</li>
<li class="subList__item">bi-weekly</li>
<li class="subList__item">yesterday</li>
<li class="subList__item">today</li>
</ul>
</li>
<li>
<div class="navList__subheading row row--align-v-center">
<span class="navList__subheading-icon"><i class="fas fa-plane"></i></span>
<span class="navList__subheading-title">trip logs</span>
</div>
<ul class="subList subList--hidden">
<li class="subList__item">amsterdam</li>
<li class="subList__item">buenos aires</li>
<li class="subList__item">cambodia</li>
<li class="subList__item">greenland</li>
</ul>
</li>
<li class="navList__heading">Events<i class="fas fa-calendar-alt"></i></li>
<li>
<div class="navList__subheading row row--align-v-center">
<span class="navList__subheading-icon"><i class="fas fa-wine-glass-alt"></i></span>
<span class="navList__subheading-title">weddings</span>
</div>
<ul class="subList subList--hidden">
<li class="subList__item">past</li>
<li class="subList__item">present</li>
<li class="subList__item">future</li>
</ul>
</li>
<li>
<div class="navList__subheading row row--align-v-center">
<span class="navList__subheading-icon"><i class="fas fa-school"></i></span>
<span class="navList__subheading-title">playdates</span>
</div>
<ul class="subList subList--hidden">
<li class="subList__item">weirdos</li>
<li class="subList__item">smarties</li>
<li class="subList__item">nerds</li>
</ul>
</li>
<li>
<div class="navList__subheading row row--align-v-center">
<span class="navList__subheading-icon"><i class="fas fa-users"></i></span>
<span class="navList__subheading-title">networking</span>
</div>
<ul class="subList subList--hidden">
<li class="subList__item">tech</li>
<li class="subList__item">automotive</li>
<li class="subList__item">UX research</li>
<li class="subList__item">development</li>
</ul>
</li>
</ul>
</div>
</aside>
<main class="main">
<div class="main-header">
<div class="main-header__intro-wrapper">
<div class="main-header__welcome">
<div class="main-header__welcome-title text-light">Welcome, <strong>Matthew</strong></div>
<div class="main-header__welcome-subtitle text-light">How are you today?</div>
</div>
<div class="quickview">
<div class="quickview__item">
<div class="quickview__item-total">41</div>
<div class="quickview__item-description">
<i class="far fa-calendar-alt"></i>
<span class="text-light">Events</span>
</div>
</div>
<div class="quickview__item">
<div class="quickview__item-total">64</div>
<div class="quickview__item-description">
<i class="far fa-comment"></i>
<span class="text-light">Messages</span>
</div>
</div>
<div class="quickview__item">
<div class="quickview__item-total">27°</div>
<div class="quickview__item-description">
<i class="fas fa-map-marker-alt"></i>
<span class="text-light">Austin</span>
</div>
</div>
</div>
</div>
</div>
<div class="main-overview">
<div class="overviewCard">
<div class="overviewCard-icon overviewCard-icon--document">
<i class="far fa-file-alt"></i>
</div>
<div class="overviewCard-description">
<h3 class="overviewCard-title text-light">New <strong>Document</strong></h3>
<p class="overviewCard-subtitle">Europe Trip</p>
</div>
</div>
<div class="overviewCard">
<div class="overviewCard-icon overviewCard-icon--calendar">
<i class="far fa-calendar-check"></i>
</div>
<div class="overviewCard-description">
<h3 class="overviewCard-title text-light">Upcoming <strong>Event</strong></h3>
<p class="overviewCard-subtitle">Chili Cookoff</p>
</div>
</div>
<div class="overviewCard">
<div class="overviewCard-icon overviewCard-icon--mail">
<i class="far fa-envelope"></i>
</div>
<div class="overviewCard-description">
<h3 class="overviewCard-title text-light">Recent <strong>Emails</strong></h3>
<p class="overviewCard-subtitle">+10</p>
</div>
</div>
<div class="overviewCard">
<div class="overviewCard-icon overviewCard-icon--photo">
<i class="far fa-file-image"></i>
</div>
<div class="overviewCard-description">
<h3 class="overviewCard-title text-light">New <strong>Album</strong></h3>
<p class="overviewCard-subtitle">House Concert</p>
</div>
</div>
</div> <!-- /.main__overview -->
<div class="main__cards">
<div class="card">
<div class="card__header">
<div class="card__header-title text-light">Your <strong>Events</strong>
<a href="#" class="card__header-link text-bold">View All</a>
</div>
<div class="settings">
<div class="settings__block"><i class="fas fa-edit"></i></div>
<div class="settings__block"><i class="fas fa-cog"></i></div>
</div>
</div>
<div class="card__main">
<div class="card__row">
<div class="card__icon"><i class="fas fa-gift"></i></div>
<div class="card__time">
<div>today</div>
</div>
<div class="card__detail">
<div class="card__source text-bold">Jonathan G</div>
<div class="card__description">Going away party at 8:30pm. Bring a friend!</div>
<div class="card__note">1404 Gibson St</div>
</div>
</div>
<div class="card__row">
<div class="card__icon"><i class="fas fa-plane"></i></div>
<div class="card__time">
<div>Tuesday</div>
</div>
<div class="card__detail">
<div class="card__source text-bold">Matthew H</div>
<div class="card__description">Flying to Bora Bora at 4:30pm</div>
<div class="card__note">Delta, Gate 27B</div>
</div>
</div>
<div class="card__row">
<div class="card__icon"><i class="fas fa-book"></i></div>
<div class="card__time">
<div>Thursday</div>
</div>
<div class="card__detail">
<div class="card__source text-bold">National Institute of Science</div>
<div class="card__description">Join the institute for an in-depth look at Stephen Hawking</div>
<div class="card__note">7:30pm, Carnegie Center for Science</div>
</div>
</div>
<div class="card__row">
<div class="card__icon"><i class="fas fa-heart"></i></div>
<div class="card__time">
<div>Friday</div>
</div>
<div class="card__detail">
<div class="card__source text-bold">24th Annual Heart Ball</div>
<div class="card__description">Join us and contribute to your favorite local charity.</div>
<div class="card__note">6:45pm, Austin Convention Ctr</div>
</div>
</div>
<div class="card__row">
<div class="card__icon"><i class="fas fa-heart"></i></div>
<div class="card__time">
<div>Saturday</div>
</div>
<div class="card__detail">
<div class="card__source text-bold">Little Rock Air Show</div>
<div class="card__description">See the Blue Angels fly with roaring thunder</div>
<div class="card__note">11:00pm, Jacksonville Airforce Base</div>
</div>
</div>
</div>
</div>
<div class="card">
<div class="card__header">
<div class="card__header-title text-light">Recent <strong>Documents</strong>
<a href="#" class="card__header-link text-bold">View All</a>
</div>
<div class="settings">
<div class="settings__block"><i class="fas fa-edit"></i></div>
<div class="settings__block"><i class="fas fa-cog"></i></div>
</div>
</div>
<div class="card">
<div class="documents">
<div class="document">
<div class="document__img"></div>
<div class="document__title">tesla-patents</div>
<div class="document__date">07/16/2018</div>
</div>
<div class="document">
<div class="document__img"></div>
<div class="document__title">yearly-budget</div>
<div class="document__date">09/04/2018</div>
</div>
<div class="document">
<div class="document__img"></div>
<div class="document__title">top-movies</div>
<div class="document__date">10/10/2018</div>
</div>
<div class="document">
<div class="document__img"></div>
<div class="document__title">trip-itinerary</div>
<div class="document__date">11/01/2018</div>
</div>
</div>
</div>
</div>
<div class="card card--finance">
<div class="card__header">
<div class="card__header-title text-light">Monthly <strong>Spending</strong>
<a href="#" class="card__header-link text-bold">View All</a>
</div>
<div class="settings">
<div class="settings__block"><i class="fas fa-edit"></i></div>
<div class="settings__block"><i class="fas fa-cog"></i></div>
</div>
</div>
<div id="chartdiv"></div>
</div>
</div> <!-- /.main-cards -->
</main>
<footer class="footer">
<p><span class="footer__copyright">©</span> 2018 MTH</p>
<p>Crafted with <i class="fas fa-heart footer__icon"></i> by <a href="https://www.linkedin.com/in/matt-holland/" target="_blank" class="footer__signature">Matt H</a></p>
</footer>
</div>
// Sass tils
$color-fiord: #394263; // sidenav bg & dark text
$color-white: #FFF; // card bg
$color-athens-gray: #EAEDF1; // content bg
$color-catskill-white: #F9FAFC; // top nav bg
$color-abbey: #777; // gray text
$color-mischka: #DADAE3; // light gray for menu icon
$color-java: #1BBAE1; // blue text
$color-mine-shaft: #333; // main section header bg
$color-zest: #e67e22; // document icon bg
$color-jungle-green: #27ae60; // calendar icon bg
$color-cinnabar: #e74c3c; // main icon bg, red
$color-amethyst: #af64cc; // main photo icon bg
$color-transparent: rgba(255, 255, 255, .5);
$color-alto: #D3D3D3;
$height-header: 50px;
$height-footer: 50px;
$width-sidenav: 240px;
@mixin profile-avatar {
background-image: url("https://s3-us-west-2.amazonaws.com/s.cdpn.io/1609106/headshot.png");
background-size: cover;
background-repeat: no-repeat;
border-radius: 50%;
border: 2px solid rgba(255, 255, 255, .2);
}
@mixin box-shadow {
box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.16), 0 0 0 1px rgba(0, 0, 0, 0.08);
}
// Resets
html, body {
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: "Open Sans","Helvetica Neue",Helvetica,Arial,sans-serif
}
a {
text-decoration: none;
}
// Util classes
.text-light {
font-weight: 300;
}
.text-bold {
font-weight: bold;
}
.row {
display: flex;
&--align-v-center {
align-items: center;
}
&--align-h-center {
justify-content: center;
}
}
// Establish dashboard css grid layout - mobile
.grid {
position: relative;
display: grid;
grid-template-columns: 100%; // Charts responsiveness won't work with fr units
grid-template-rows: $height-header 1fr $height-footer;
grid-template-areas:
'header'
'main'
'footer';
height: 100vh;
overflow-x: hidden; // Prevent overflow scroll from hidden sidenav
&--noscroll {
overflow-y: hidden;
}
}
.header {
grid-area: header;
display: flex;
align-items: center;
justify-content: space-between;
background-color: $color-catskill-white;
&__menu {
position: fixed; // Needs to stay visible for all mobile scrolling
padding: 13px;
left: 12px;
background-color: $color-mischka;
border-radius: 50%;
z-index: 1;
&:hover {
cursor: pointer;
}
}
&__search {
margin-left: 55px;
font-size: 20px;
color: $color-abbey;
}
&__input {
border: none;
background: transparent;
padding: 12px;
font-size: 20px;
color: $color-abbey;
&:focus {
outline: none;
border: none;
}
}
&__avatar {
@include profile-avatar;
position: relative;
margin: 0 26px;
width: 35px;
height: 35px;
cursor: pointer;
&:after {
position: absolute;
content: "";
width: 6px;
height: 6px;
background: none;
border-left: 2px solid $color-abbey;
border-bottom: 2px solid $color-abbey;
transform: rotate(-45deg) translateY(-50%);
top: 50%;
right: -18px;
}
}
}
.dropdown {
position: absolute;
top: 54px;
right: -16px;
width: 220px;
height: auto;
z-index: 1;
background-color: #fff;
border-radius: 4px;
visibility: hidden;
opacity: 0;
transform: translateY(-10px);
transition: all .3s;
@include box-shadow;
&__list {
margin: 0;
padding: 0;
list-style-type: none;
}
&__list-item {
padding: 12px 24px;
color: $color-abbey;
text-transform: capitalize;
&:hover {
background-color: rgba(0,0,0, .1);
}
}
&__icon {
color: $color-java;
}
&__title {
margin-left: 10px;
}
&:before {
position: absolute;
content: "";
top: -6px;
right: 30px;
width: 0;
height: 0;
border-left: 4px solid transparent;
border-right: 4px solid transparent;
border-bottom: 6px solid #FFF;
}
&--active {
visibility: visible;
opacity: 1;
transform: translateY(0);
}
}
.sidenav {
position: fixed; // Access sidenav at any scroll position; relatively positioned on medium + screens
grid-area: sidenav;
height: 100%;
overflow-y: auto;
background-color: $color-fiord;
color: $color-white;
width: $width-sidenav; // Will match grid area on medium + screens
transform: translateX(-245px);
transition: all .6s ease-in-out;
box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.16), 0 0 0 1px rgba(0, 0, 0, 0.08);
z-index: 2; // Needs to sit above the hamburger menu icon
&__brand {
position: relative;
display: flex;
align-items: center;
padding: 0 16px;
height: $height-header;
background-color: rgba(0, 0, 0, .15);
&-icon {
margin-top: 2px;
font-size: 14px;
color: $color-transparent;
}
&-close {
position: absolute;
right: 8px;
top: 8px;
visibility: visible;
color: $color-transparent;
cursor: pointer;
}
&-link {
font-size: 18px;
font-weight: bold;
color: $color-white;
margin: 0 15px;
letter-spacing: 1.5px;
}
}
&__profile {
display: flex;
align-items: center;
min-height: 90px;
background-color: rgba(255, 255, 255, .1);
&-avatar {
@include profile-avatar;
height: 64px;
width: 64px;
margin: 0 15px;
}
&-title {
font-size: 17px;
letter-spacing: 1px;
}
}
&__arrow {
position: absolute;
content: "";
width: 6px;
height: 6px;
top: 50%;
right: 20px;
border-left: 2px solid rgba(255,255,255,.5);
border-bottom: 2px solid rgba(255,255,255,.5);
transform: translateY(-50%) rotate(225deg);
}
&__sublist {
list-style-type: none;
margin: 0;
padding: 10px 0 0;
}
&--active {
transform: translateX(0);
}
}
.navList {
width: $width-sidenav;
padding: 0;
margin: 0;
background-color: $color-fiord;
list-style-type: none;
&__heading {
position: relative;
display: flex;
align-items: center;
justify-content: space-between;
padding: 16px 16px 3px;
color: $color-transparent;
text-transform: uppercase;
font-size: 15px;
}
&__subheading {
position: relative;
padding: 10px 30px;
color: #fff;
font-size: 16px;
text-transform: capitalize;
&-icon {
display: flex;
align-items: center;
justify-content: center;
font-size: 12px;
color: $color-transparent;
width: 12px; // Keep spacing consistent
}
&-title {
margin: 0 15px;
}
&:after {
position: absolute;
content: "";
height: 6px;
width: 6px;
top: 17px;
right: 25px;
border-left: 1px solid $color-transparent;
border-bottom: 1px solid $color-transparent;
transform: rotate(225deg);
transition: all .2s;
}
&:hover {
background-color: darken($color-fiord, 5%);
cursor: pointer;
}
&--open {
background-color: darken($color-fiord, 5%);
&:after {
transform: rotate(315deg);
}
}
}
.subList {
padding: 0;
margin: 0;
list-style-type: none;
background-color: darken($color-fiord, 10%);
visibility: visible;
overflow: hidden;
max-height: 200px;
transition: all .4s ease-in-out;
&__item {
padding: 8px;
text-transform: capitalize;
padding: 8px 30px;
color: $color-alto;
&:first-child {
padding-top: 15px;
}
&:hover {
background-color: rgba(255, 255, 255, .1);
cursor: pointer;
}
}
&--hidden {
visibility: hidden;
max-height: 0;
}
}
}
// Dashboard content wrapper
.main {
grid-area: main;
background-color: $color-athens-gray;
color: $color-fiord;
&__cards {
display: block;
column-count: 1;
column-gap: 20px;
margin: 20px;
}
}
.main-header {
position: relative;
display: flex;
justify-content: space-between;
height: 250px;
color: $color-white;
background-size: cover;
background-image: url("https://s3-us-west-2.amazonaws.com/s.cdpn.io/1609106/lake-shadow-water.jpg");
margin-bottom: 20px;
&__intro-wrapper {
display: flex;
flex: 1;
flex-direction: column; // Mobile-first; break out to row on medium + screens
align-items: center;
justify-content: space-between;
height: 160px;
padding: 12px 30px;
background: rgba(255,255,255,.12);
font-size: 26px;
letter-spacing: 1px;
}
&__welcome {
display: flex;
flex-direction: column;
align-items: center;
&-title {
margin-bottom: 8px;
font-size: 26px;
}
&-subtitle {
font-size: 18px;
}
}
}
// Main header quick view update items
.quickview {
display: grid;
grid-auto-flow: column;
grid-gap: 60px;
&__item {
display: flex;
align-items: center;
flex-direction: column;
&-total {
margin-bottom: 2px;
font-size: 32px;
}
&-description {
font-size: 16px;
text-align: center;
}
}
}
// Overview quicklink cards container
.main-overview {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(265px, 1fr));
grid-auto-rows: 94px;
grid-gap: 30px;
margin: 20px;
}
.overviewCard {
display: flex;
align-items: center;
justify-content: space-between;
padding: 12px;
background-color: $color-white;
transform: translateY(0);
transition: all .3s;
&-icon {
display: flex;
align-items: center;
justify-content: center;
height: 60px;
width: 60px;
border-radius: 50%;
font-size: 21px;
color: #fff;
&--document {
background-color: $color-zest;
}
&--calendar {
background-color: $color-jungle-green;
}
&--mail {
background-color: $color-cinnabar;
}
&--photo {
background-color: $color-amethyst;
}
}
&-description {
display: flex;
flex-direction: column;
align-items: center;
}
&-title {
font-size: 18px;
color: $color-java;
margin: 0;
}
&-subtitle {
margin: 2px;
color: $color-abbey;
}
&:hover {
transform: translateY(-3px);
box-shadow: 0 5px 5px rgba(0,0,0,.1);
cursor: pointer;
}
}
.card {
display: flex;
flex-direction: column;
width: 100%;
background-color: #fff;
margin-bottom: 20px;
-webkit-column-break-inside: avoid;
&__header {
display: flex;
align-items: center;
justify-content: space-between;
height: 50px;
background-color: $color-fiord;
color: $color-white;
&-title {
margin: 0 20px;
font-size: 20px;
letter-spacing: 1.2px;
}
&-link {
font-size: 16px;
color: $color-java;
letter-spacing: normal;
display: inline-block;
}
}
&__main {
position: relative;
padding-right: 20px;
background-color: $color-white;
&:after {
content: "";
position: absolute;
top:0;
left: 120px;
bottom: 0;
width: 2px;
background-color: #f0f0f0;
}
}
&__secondary {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
grid-auto-rows: 100px;
grid-gap: 25px;
padding: 20px;
background-color: $color-white;
}
&__photo {
background-image: url('../../img/pumpkin-carving.jpg');
background-size: cover;
background-repeat: no-repeat;
background-color: slategray;
// overflow: hidden;
transform: scale(1);
transition: transform .3s ease-in-out;
width: 100%;
height: 100%;
&:hover {
transform: scale(1.1);
cursor: pointer;
}
}
&__photo-wrapper {
overflow: hidden;
}
&__row {
position: relative;
display: flex;
flex: 1;
margin: 15px 0 20px;
}
&__icon {
position: absolute;
display: flex;
align-items: center;
justify-content: center;
content: "";
width: 30px;
height: 30px;
top: 0;
left: 121px;
transform: translateX(-50%);
border-radius: 50%;
color: $color-white;
background-color: $color-java;
z-index: 1;
}
&__row:nth-child(even) {
.card__icon {
background-color: $color-cinnabar;
}
}
&__time {
display: flex;
flex: 1;
justify-content: flex-end;
max-width: 80px;
margin-left: 15px;
text-align: right;
font-size: 14px;
line-height: 2;
}
&__detail {
display: flex;
flex: 1;
flex-direction: column;
padding-left: 12px;
margin-left: 48px;
transform: translateX(0);
transition: all .3s;
&:hover {
background-color: #f0f0f0;
transform: translateX(4px);
cursor: pointer;
}
}
&__source {
line-height: 1.8;
color: $color-java;
}
&__description {
}
&__note {
margin: 10px 0;
color: $color-abbey;
}
&--finance {
position: relative;
}
}
// Card header settings icons
.settings {
display: flex;
margin: 8px;
align-self: flex-start;
background-color: $color-transparent;
border: 1px solid rgba(0,0,0,.1);
border-radius: 2px;
&__block {
display: flex;
align-items: center;
justify-content: center;
padding: 4px;
color: $color-fiord;
font-size: 11px;
&:not(:last-child) {
border-right: 1px solid rgba(0,0,0,.1);
}
}
&__icon {
padding: 0px 3px;
font-size: 12px;
&:hover {
background-color: rgba(255,255,255,.8);
cursor: pointer;
}
}
&:hover {
background-color: #fff;
cursor: pointer;
}
}
.documents {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(105px, 1fr));
grid-auto-rows: 214px;
grid-gap: 12px;
height: auto;
background-color: $color-white;
}
.document {
display: flex;
align-items: center;
justify-content: center;
margin: 15px 0 0;
flex-direction: column;
&__img {
width: 105px;
height: 136px;
background-image: url("https://s3-us-west-2.amazonaws.com/s.cdpn.io/1609106/doc-1.png");
background-size: cover;
box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.14), 0 3px 1px -2px rgba(0, 0, 0, 0.12), 0 1px 5px 0 rgba(0, 0, 0, 0.2);
cursor: pointer;
transition: transform .3s ease;
&:hover {
transform: translateY(-4px);
}
}
&__title {
margin: 8px 0 2px;
color: $color-abbey;
}
&__date {
font-size: 10px;
}
}
// Styles for example chart
#chartdiv {
width: 100%;
height: 300px;
font-size: 11px;
min-width: 0;
}
.footer {
grid-area: footer;
display: flex;
align-items: center;
justify-content: space-between;
padding: 0 16px;
color: $color-abbey;
background-color: $color-white;
&__copyright {
color: $color-java;
}
&__icon {
color: $color-cinnabar;
}
&__signature {
color: $color-java;
cursor: pointer;
font-weight: bold;
}
}
// Mobile screen breakpoints (750px)
@media only screen and (min-width: 46.875em) {
// Break out to sidenav grid layout on medium + screens
.grid {
display: grid;
grid-template-columns: $width-sidenav calc(100% - 240px); // Charts responsiveness won't work with fr units
grid-template-rows: $height-header 1fr $height-footer;
grid-template-areas:
'sidenav header'
'sidenav main'
'sidenav footer';
height: 100vh;
}
.sidenav {
position: relative;
transform: translateX(0);
&__brand-close {
visibility: hidden;
}
}
.main-header {
&__intro-wrapper {
padding: 0 30px;
}
}
.header {
&__menu {
display: none;
}
&__search {
margin-left: 20px; // No menu icon; move 'er back over
}
&__avatar {
width: 40px;
height: 40px;
}
}
}
// Medium screens breakpoint (1050px)
@media only screen and (min-width: 65.625em) {
.main {
&__cards {
column-count: 2;
}
}
.main-header {
&__intro-wrapper {
flex-direction: row;
}
&__welcome {
align-items: flex-start;
}
}
}
View Compiled
/* Scripts for css grid dashboard */
$(document).ready(() => {
addResizeListeners();
setSidenavListeners();
setUserDropdownListener();
renderChart();
setMenuClickListener();
setSidenavCloseListener();
});
// Set constants and grab needed elements
const sidenavEl = $('.sidenav');
const gridEl = $('.grid');
const SIDENAV_ACTIVE_CLASS = 'sidenav--active';
const GRID_NO_SCROLL_CLASS = 'grid--noscroll';
function toggleClass(el, className) {
if (el.hasClass(className)) {
el.removeClass(className);
} else {
el.addClass(className);
}
}
// User avatar dropdown functionality
function setUserDropdownListener() {
const userAvatar = $('.header__avatar');
userAvatar.on('click', function(e) {
const dropdown = $(this).children('.dropdown');
toggleClass(dropdown, 'dropdown--active');
});
}
// Sidenav list sliding functionality
function setSidenavListeners() {
const subHeadings = $('.navList__subheading'); console.log('subHeadings: ', subHeadings);
const SUBHEADING_OPEN_CLASS = 'navList__subheading--open';
const SUBLIST_HIDDEN_CLASS = 'subList--hidden';
subHeadings.each((i, subHeadingEl) => {
$(subHeadingEl).on('click', (e) => {
const subListEl = $(subHeadingEl).siblings();
// Add/remove selected styles to list category heading
if (subHeadingEl) {
toggleClass($(subHeadingEl), SUBHEADING_OPEN_CLASS);
}
// Reveal/hide the sublist
if (subListEl && subListEl.length === 1) {
toggleClass($(subListEl), SUBLIST_HIDDEN_CLASS);
}
});
});
}
// Draw the chart
function renderChart() {
const chart = AmCharts.makeChart( "chartdiv", {
"type": "serial",
"theme": "light",
"dataProvider": [ {
"month": "Jan",
"visits": 2025
}, {
"month": "Feb",
"visits": 1882
}, {
"month": "Mar",
"visits": 1809
}, {
"month": "Apr",
"visits": 1322
}, {
"month": "May",
"visits": 1122
}, {
"month": "Jun",
"visits": 1114
}, {
"month": "Jul",
"visits": 984
}, {
"month": "Aug",
"visits": 711
}, {
"month": "Sept",
"visits": 665
}, {
"month": "Oct",
"visits": 580
} ],
"valueAxes": [ {
"gridColor": "#FFFFFF",
"gridAlpha": 0.2,
"dashLength": 0
} ],
"gridAboveGraphs": true,
"startDuration": 1,
"graphs": [ {
"balloonText": "[[category]]: <b>[[value]]</b>",
"fillAlphas": 0.8,
"lineAlpha": 0.2,
"type": "column",
"valueField": "visits"
} ],
"chartCursor": {
"categoryBalloonEnabled": false,
"cursorAlpha": 0,
"zoomable": false
},
"categoryField": "month",
"categoryAxis": {
"gridPosition": "start",
"gridAlpha": 0,
"tickPosition": "start",
"tickLength": 20
},
"export": {
"enabled": false
}
});
}
function toggleClass(el, className) {
if (el.hasClass(className)) {
el.removeClass(className);
} else {
el.addClass(className);
}
}
// If user opens the menu and then expands the viewport from mobile size without closing the menu,
// make sure scrolling is enabled again and that sidenav active class is removed
function addResizeListeners() {
$(window).resize(function(e) {
const width = window.innerWidth; console.log('width: ', width);
if (width > 750) {
sidenavEl.removeClass(SIDENAV_ACTIVE_CLASS);
gridEl.removeClass(GRID_NO_SCROLL_CLASS);
}
});
}
// Menu open sidenav icon, shown only on mobile
function setMenuClickListener() {
$('.header__menu').on('click', function(e) { console.log('clicked menu icon');
toggleClass(sidenavEl, SIDENAV_ACTIVE_CLASS);
toggleClass(gridEl, GRID_NO_SCROLL_CLASS);
});
}
// Sidenav close icon
function setSidenavCloseListener() {
$('.sidenav__brand-close').on('click', function(e) {
toggleClass(sidenavEl, SIDENAV_ACTIVE_CLASS);
toggleClass(gridEl, GRID_NO_SCROLL_CLASS);
});
}
This Pen doesn't use any external CSS resources.