site-menu styling/layout/functionality

This commit is contained in:
ManjaroOne666 2019-01-16 21:09:55 +00:00
parent ad14611129
commit 11654f494c
8 changed files with 177 additions and 32 deletions

View File

@ -6,3 +6,16 @@
html { html {
overflow: hidden; overflow: hidden;
} }
body {
font-family: 'Raleway', sans-serif;
font-size: 100%;
}
a {
font-family: 'Montserrat', sans-serif;
}
h1, h2, h3, h4, h5, h6 {
font-family: 'Montserrat', sans-serif;
}

8
assets/scss/_buefy.scss Normal file
View File

@ -0,0 +1,8 @@
$link: $color__neutral-800;
$link-hover: $color__primary-500;
$primary: #f00;
@import "~bulma/sass/utilities/_all.sass";
@import "~bulma/bulma.sass";
@import "~buefy/src/scss/buefy";

View File

@ -1,4 +1,5 @@
@import 'palette'; @import 'palette';
@import 'mixins';
$bp__m: 40em; $bp__m: 40em;
@ -6,7 +7,9 @@ $bp__m: 40em;
$bp__layout: 40em; $bp__layout: 40em;
$z-index__page: 50; $z-index__page: 50;
$z-index__page-overlay: 75;
$z-index__menu: 100; $z-index__menu: 100;
$site-menu__width: 25rem;
$site-menu__header-width: 3rem; $site-menu__header-width: 3rem;
$site-menu__header-height: 3rem; $site-menu__header-height: 3rem;

10
assets/scss/_mixins.scss Normal file
View File

@ -0,0 +1,10 @@
@mixin font-body($weight: 400) {
font-family: 'Raleway', sans-serif;
font-weight: $weight;
}
@mixin font-title($weight: 400) {
font-family: 'Montserrat', sans-serif;
letter-spacing: 1px;
font-weight: $weight;
}

View File

@ -1 +1,2 @@
@import 'buefy';
@import 'base'; @import 'base';

View File

@ -1,8 +1,12 @@
<template> <template>
<section :class="{ 'is-open': isOpen }" <section :class="{ 'is-open': isOpen }"
class="menu-drawer menu-layout" class="menu-drawer menu-layout"
>
<div class="menu-header__item menu-toggle"
@click="$emit('toggleMenu')" @click="$emit('toggleMenu')"
> >
<div class="menu-bars"></div>
</div>
<div class="menu-content"> <div class="menu-content">
<div class="menu-close">close</div> <div class="menu-close">close</div>
<nav class="menu-content__body"> <nav class="menu-content__body">
@ -29,20 +33,20 @@
> >
<b-icon class="social-nav__icon" <b-icon class="social-nav__icon"
:icon="item.icon" :icon="item.icon"
> />
</b-icon>
</a> </a>
</li> </li>
</ul> </ul>
</nav> </nav>
<footer class="menu-content__footer"> <footer class="menu-content__footer">
<p class="footer-attr">Copyright &copy; 2019 Marc Leopold Photography</p> <p class="footer-attr">Copyright &copy; {{ new Date().getFullYear() }} Marc Leopold Photography</p>
</footer> </footer>
</div> </div>
<div class="menu-header"> <div class="menu-header"
@click="$emit('toggleMenu')"
>
<div class="menu-header__inner"> <div class="menu-header__inner">
<span class="menu-header__item site-title">Marc Leopold Photography</span> <span class="menu-header__item site-title">Marc Leopold Photography</span>
<div class="menu-header__item menu-toggle">X</div>
</div> </div>
</div> </div>
</section> </section>
@ -81,7 +85,10 @@ export default {
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
$transition-timing: .5s;
.menu-drawer { .menu-drawer {
position: absolute; position: absolute;
width: 100%; width: 100%;
height: 100%; height: 100%;
@ -90,7 +97,7 @@ export default {
font-size: 1rem; font-size: 1rem;
transition: transform .5s; transition: transform $transition-timing;
transform: translate3d(0, $site-menu__header-width, 0); transform: translate3d(0, $site-menu__header-width, 0);
&.is-open { &.is-open {
@ -98,7 +105,7 @@ export default {
} }
@media (min-width: $bp__layout) { @media (min-width: $bp__layout) {
width: 25em; width: $site-menu__width;
top: 0; top: 0;
right: 100%; right: 100%;
transform: translate3d($site-menu__header-width, 0, 0); transform: translate3d($site-menu__header-width, 0, 0);
@ -160,15 +167,34 @@ export default {
} }
.menu-header { .menu-header {
$color-bg: $color__primary-300;
$color-shade: darken($color__primary-300, 5);
position: relative; position: relative;
flex: 0 0 $site-menu__header-height; flex: 0 0 $site-menu__header-height;
color: $color__neutral-700; color: $color__primary-100;
background-color: $color__neutral-300; background-color: $color-bg;
opacity: .97; background: linear-gradient(
to right,
$color-shade,
$color-bg,
$color-bg,
$color-shade
);
cursor: pointer;
@media (min-width: $bp__layout) { @media (min-width: $bp__layout) {
max-width: $site-menu__header-width; max-width: $site-menu__header-width;
background: linear-gradient(
to top,
$color-shade,
$color-bg,
$color-bg,
$color-shade
);
opacity: .97;
} }
} }
@ -210,30 +236,14 @@ export default {
text-transform: uppercase; text-transform: uppercase;
line-height: 1.1; line-height: 1.1;
@include font-title(); @include font-title($weight: 400);
@media (min-width: $bp__layout) { @media (min-width: $bp__layout) {
font-size: 1.4rem; font-size: 1.4rem;
letter-spacing: 1.3px;
} }
} }
.menu-toggle {
$width: 2rem;
$margin: ($site-menu__header-width - $width) / 2;
width: $width;
height: $width;
position: absolute;
right: $margin;
top: $margin;
@media (min-width: $bp__layout) {
transform: rotate(90deg);
}
background-color: rgba(yellow, .3); // TEMP
}
.menu-close { .menu-close {
display: none; display: none;
@ -296,9 +306,70 @@ export default {
} }
.footer-attr { .footer-attr {
color: $color__neutral-500;
font-size: .7em; font-size: .7em;
} }
.menu-toggle {
$width: 2rem;
$margin: ($site-menu__header-width - $width) / 2;
z-index: 10;
position: absolute;
width: $width;
height: $width;
right: $margin;
bottom: $margin;
cursor: pointer;
transition: opacity .2s;
opacity: .6;
&:hover {
opacity: .8;
}
@media (min-width: $bp__layout) {
bottom: auto;
top: $margin;
}
}
.menu-bars {
$color: $color__primary-800;
$width: 4px;
$padding: 4px; // padding on top/bottom
position: absolute;
width: 100%;
top: $padding;
bottom: $padding;
left: 0;
border-top: $width solid $color;
border-bottom: $width solid $color;
transition: transform .3s .2s ease-out;
transform: scale(1, .7);
&::after {
content: '';
position: absolute;
width: 100%;
height: $width;
left: 0;
top: calc(50% - #{$width / 2});
background-color: $color;
}
@at-root .menu.is-open & {
transform: none;
}
}
</style> </style>
<style lang="scss"> <style lang="scss">
@ -307,5 +378,4 @@ export default {
font-size: 1.1em; font-size: 1.1em;
} }
} }
</style> </style>

View File

@ -1,6 +1,11 @@
<template> <template>
<div class="page-container"> <div class="page-container">
<div class="page"> <div class="page">
<div class="page-overlay"
:class="{ 'is-active': isMenuOpen }"
@click="closeMenu"
>
</div>
<nuxt /> <nuxt />
</div> </div>
<SiteMenu class="menu" <SiteMenu class="menu"
@ -27,7 +32,10 @@ export default {
methods: { methods: {
toggleMenu () { toggleMenu () {
this.isMenuOpen = !this.isMenuOpen this.isMenuOpen = !this.isMenuOpen
} },
closeMenu () {
this.isMenuOpen = false
},
} }
} }
</script> </script>
@ -51,6 +59,37 @@ export default {
height: 100%; height: 100%;
} }
.page-overlay {
$color: $color__primary-100;
z-index: $z-index__page-overlay;
position: absolute;
width: 100%;
height: 100%;
top: 0;
left: 0;
background-color: rgba($color, .6);
background: linear-gradient(
to right,
rgba($color, 1),
rgba($color, 1) $site-menu__width + 3rem,
rgba($color, .8),
rgba($color, 1)
);
box-shadow: 0 0 70px 40px $color inset;
transition: opacity .5s .2s;
opacity: 0;
pointer-events: none;
@media (min-width: $bp__layout) {
&.is-active {
opacity: 1;
pointer-events: auto;
}
}
}
.menu { .menu {
z-index: $z-index__menu; z-index: $z-index__menu;
} }

View File

@ -18,7 +18,8 @@ module.exports = {
{ hid: 'description', name: 'description', content: pkg.description } { hid: 'description', name: 'description', content: pkg.description }
], ],
link: [ link: [
{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' } { rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' },
{ rel: 'stylesheet', href: 'https://fonts.googleapis.com/css?family=Montserrat:400,500,600,700,800|Raleway:400,500,600,700,800,900' },
] ]
}, },