marc-leopold/components/SiteMenu.vue

616 lines
12 KiB
Vue
Raw Normal View History

2019-01-02 21:12:22 +00:00
<template>
2019-01-02 22:14:56 +00:00
<section :class="{ 'is-open': isOpen }"
class="menu-drawer menu-layout"
2019-01-16 17:21:59 +00:00
>
2019-01-16 21:09:55 +00:00
<div class="menu-header__item menu-toggle"
@click="$emit('toggleMenu')"
>
<div class="menu-bars"></div>
</div>
2019-01-02 22:14:56 +00:00
<div class="menu-content">
2019-01-16 22:55:56 +00:00
<div class="menu-close"
@click="$emit('closeMenu')"
>
<span class="menu-close__content">close</span>
</div>
2019-01-04 12:09:44 +00:00
<nav class="menu-content__body">
<ul class="site-nav">
2019-01-16 17:21:59 +00:00
<li class="site-nav__item"
v-for="item in siteNav"
:key="item.to"
2019-01-16 22:55:56 +00:00
@click="$emit('closeMenu')"
2019-01-16 17:21:59 +00:00
>
2019-01-23 21:40:20 +00:00
<div v-if="item.bgImgUrl"
class="menu-background menu-link-background"
:style="{ 'background-image': loadMenuImages ? `url(${item.bgImgUrl})` : 'none' }"
2019-01-23 21:40:20 +00:00
>
</div>
2019-01-16 17:21:59 +00:00
<nuxt-link class="site-nav__link"
:to="item.to"
:exact="item.to === '/'"
2019-01-16 17:21:59 +00:00
>
{{ item.text }}
</nuxt-link>
</li>
</ul>
<ul class="site-nav__footer social-nav">
2019-01-23 11:53:25 +00:00
<li v-for="item in socialNav"
2019-01-23 21:40:20 +00:00
class="social-nav-item"
2019-01-16 17:21:59 +00:00
:key="item.to"
>
2019-01-23 21:40:20 +00:00
<div class="menu-background social-background">
<b-icon class="social-background__icon"
:icon="item.icon"
/>
</div>
2019-01-16 17:21:59 +00:00
<a class="social-nav__link"
:href="item.to"
target="_blank"
>
<b-icon class="social-nav__icon"
:icon="item.icon"
2019-01-16 21:09:55 +00:00
/>
2019-01-16 17:21:59 +00:00
</a>
2019-01-04 12:09:44 +00:00
</li>
</ul>
</nav>
2019-01-16 17:21:59 +00:00
<footer class="menu-content__footer">
2019-01-16 21:09:55 +00:00
<p class="footer-attr">Copyright &copy; {{ new Date().getFullYear() }} Marc Leopold Photography</p>
2019-01-16 17:21:59 +00:00
</footer>
2019-01-02 21:12:22 +00:00
</div>
2019-01-16 21:09:55 +00:00
<div class="menu-header"
@click="$emit('toggleMenu')"
>
2019-01-16 13:47:22 +00:00
<div class="menu-header__inner">
<span class="menu-header__item site-title">Marc Leopold Photography</span>
</div>
2019-01-02 21:12:22 +00:00
</div>
</section>
</template>
<script>
export default {
props: {
2019-01-02 22:14:56 +00:00
isOpen: {
type: Boolean,
required: true
}
2019-01-02 21:12:22 +00:00
},
data () {
return {
loadMenuImages: true,
2019-01-04 12:09:44 +00:00
siteNav: [
2019-01-30 19:53:07 +00:00
{ 'to': '/', 'text': 'Home', bgImgUrl: '/img/devices--bw.jpg'},
{ 'to': '/galleries', 'text': 'Galleries', bgImgUrl: '/img/photo-box--bw.jpg' },
{ 'to': '/services', 'text': 'Services', bgImgUrl: '/img/camera--bw.jpg' },
{ 'to': '/about', 'text': 'About Me', bgImgUrl: '/img/silhouette--dark.jpg' },
{ 'to': '/contact', 'text': 'Contact Me', bgImgUrl: '/img/mail--bw.jpg' },
2019-01-16 13:47:22 +00:00
],
socialNav: [
2019-01-16 17:21:59 +00:00
{ 'to': 'https://www.instagram.com', 'text': 'Instagram', icon: 'instagram' },
{ 'to': 'https://www.facebook.com', 'text': 'Facebook', icon: 'facebook' },
{ 'to': 'https://twitter.com', 'text': 'Twitter', icon: 'twitter' },
{ 'to': 'https://uk.linkedin.com', 'text': 'LinkedIn', icon: 'linkedin' },
2019-01-04 12:09:44 +00:00
]
2019-01-02 21:12:22 +00:00
}
},
mounted () {
const mq = window.matchMedia("(min-width: 40em)")
this.loadMenuImages = mq.matches
},
2019-01-02 21:12:22 +00:00
}
</script>
<style lang="scss" scoped>
2019-01-16 21:09:55 +00:00
$transition-timing: .5s;
2019-01-02 22:14:56 +00:00
.menu-drawer {
2019-01-16 21:09:55 +00:00
2019-01-02 21:12:22 +00:00
position: absolute;
width: 100%;
height: 100%;
right: 0;
top: -100%;
2019-01-16 13:47:22 +00:00
font-size: 1rem;
2019-01-02 21:12:22 +00:00
2019-01-16 21:09:55 +00:00
transition: transform $transition-timing;
2019-01-02 21:12:22 +00:00
transform: translate3d(0, $site-menu__header-width, 0);
&.is-open {
transform: translate3d(0, 100%, 0);
}
2019-01-03 14:06:28 +00:00
@media (min-width: $bp__layout) {
2019-01-16 21:09:55 +00:00
width: $site-menu__width;
2019-01-02 21:12:22 +00:00
top: 0;
right: 100%;
transform: translate3d($site-menu__header-width, 0, 0);
&.is-open {
transform: translate3d(100%, 0, 0);
}
}
}
2019-01-02 22:14:56 +00:00
.menu-layout {
2019-01-02 21:12:22 +00:00
display: flex;
flex-direction: column;
2019-01-03 14:06:28 +00:00
@media (min-width: $bp__layout) {
2019-01-02 21:12:22 +00:00
flex-direction: row;
}
}
2019-01-02 22:14:56 +00:00
.menu-content {
2019-01-23 21:40:20 +00:00
$color-bg: $site-menu__color-bg;
2019-01-16 22:55:56 +00:00
2019-01-16 17:21:59 +00:00
display: flex;
flex-direction: column;
padding: .5rem;
2019-01-02 21:12:22 +00:00
width: 100%;
height: 100%;
2019-01-23 21:40:20 +00:00
background-color: $site-menu__color-bg;
2019-01-16 22:55:56 +00:00
background: linear-gradient(
to right,
darken($color-bg, 2%),
$color-bg,
darken($color-bg, 2%)
);
@media (min-width: $bp__layout) {
padding: .5rem 1rem;
background: linear-gradient(
to top,
darken($color-bg, 2%),
$color-bg,
darken($color-bg, 2%)
);
}
2019-01-02 21:12:22 +00:00
}
2019-01-16 17:21:59 +00:00
.menu-content__body {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
flex: 1 0 auto;
text-align: center;
@media (min-width: $bp__layout) {
align-items: normal;
text-align: left;
}
}
.menu-content__footer {
2019-01-23 21:40:20 +00:00
position: relative;
z-index: 10;
2019-01-16 17:21:59 +00:00
display: flex;
flex-direction: column;
flex: 0 0 auto;
text-align: center;
padding: 1em 0 0;
@media (min-width: $bp__layout) {
text-align: left;
}
}
2019-01-02 22:14:56 +00:00
.menu-header {
2019-01-23 11:53:25 +00:00
$color-bg: $color__neutral-300;
$color-shade: darken($color__neutral-300, 5);
// $color-shade: $color__neutral-200;
2019-01-16 21:09:55 +00:00
2019-01-23 21:40:20 +00:00
z-index: 20;
2019-01-02 21:41:34 +00:00
position: relative;
2019-01-02 21:12:22 +00:00
flex: 0 0 $site-menu__header-height;
2019-01-27 21:57:57 +00:00
color: $color__neutral-900;
2019-01-16 21:09:55 +00:00
background-color: $color-bg;
background: linear-gradient(
to right,
$color-bg,
$color-shade
);
cursor: pointer;
2019-01-16 13:47:22 +00:00
2019-01-03 14:06:28 +00:00
@media (min-width: $bp__layout) {
2019-01-02 21:41:34 +00:00
max-width: $site-menu__header-width;
2019-01-16 21:09:55 +00:00
background: linear-gradient(
to top,
$color-shade,
$color-bg,
$color-bg,
$color-shade
);
opacity: .97;
2019-01-02 21:41:34 +00:00
}
2019-01-02 21:12:22 +00:00
}
2019-01-02 21:41:34 +00:00
2019-01-02 22:14:56 +00:00
.menu-header__inner {
2019-01-02 21:41:34 +00:00
width: 100%;
height: 100%;
2019-01-16 13:47:22 +00:00
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
padding: 0 $site-menu__header-width 0 1rem;
@media (min-width: $bp__layout) {
justify-content: center;
font-size: 1.4rem;
}
2019-01-02 21:41:34 +00:00
2019-01-03 14:06:28 +00:00
@media (min-width: $bp__layout) {
2019-01-02 21:41:34 +00:00
position: absolute;
top: 0;
right: 100%;
width: 100vh;
height: $site-menu__header-width;
transform-origin: 100% 0;
transform: rotate(-90deg);
}
}
2019-01-16 13:47:22 +00:00
.site-title {
2019-01-23 11:53:25 +00:00
font-size: 0.9rem;
2019-01-16 13:47:22 +00:00
text-transform: uppercase;
line-height: 1.1;
2019-01-16 22:55:56 +00:00
opacity: .8;
2019-01-16 13:47:22 +00:00
2019-01-16 21:09:55 +00:00
@include font-title($weight: 400);
2019-01-16 17:21:59 +00:00
2019-01-16 13:47:22 +00:00
@media (min-width: $bp__layout) {
2019-01-23 11:53:25 +00:00
font-size: 1.0rem;
2019-01-16 21:09:55 +00:00
letter-spacing: 1.3px;
2019-01-16 13:47:22 +00:00
}
}
.menu-close {
2019-01-23 21:40:20 +00:00
z-index: 30;
2019-01-16 13:47:22 +00:00
display: none;
2019-01-16 22:55:56 +00:00
position: absolute;
top: 0;
right: 0;
@include font-title();
text-transform: lowercase;
cursor: pointer;
2019-01-27 21:57:57 +00:00
color: $color__neutral-800;
2019-01-16 22:55:56 +00:00
transition: opacity 0 $transition-timing;
opacity: 0;
@at-root .menu.is-open & {
transition: opacity 1s $transition-timing + .2s;
opacity: 1;
}
2019-01-16 13:47:22 +00:00
@media (max-width: $bp__layout) {
display: initial;
}
}
2019-01-16 17:21:59 +00:00
2019-01-16 22:55:56 +00:00
.menu-close__content {
display: block;
padding: .5rem .75rem 1rem 1rem;
transition: opacity .2s;
opacity: .6;
&:hover {
opacity: .8;
}
}
2019-01-16 17:21:59 +00:00
.site-nav {
font-size: 1.4em;
@media (min-width: $bp__layout) {
font-size: .8em;
}
}
.site-nav__item {
2019-01-23 21:40:20 +00:00
z-index: 1;
2019-01-16 17:21:59 +00:00
text-transform: uppercase;
2019-01-16 22:55:56 +00:00
cursor: pointer;
2019-01-16 17:21:59 +00:00
}
.site-nav__link {
2019-01-23 21:40:20 +00:00
z-index: 5;
2019-01-16 22:55:56 +00:00
position: relative;
display: block;
2019-01-16 17:21:59 +00:00
padding: .2em 0;
2019-01-23 12:08:58 +00:00
color: $color__neutral-800;
transition: opacity .5s;
opacity: .9;
&:link, &:visited {
opacity: .9;
}
&:hover, &:active {
opacity: .5;
}
&.nuxt-link-active {
2019-01-16 22:55:56 +00:00
pointer-events: none;
2019-01-27 21:57:57 +00:00
color: $color__neutral-900;
2019-01-23 12:08:58 +00:00
opacity: 1;
2019-01-16 22:55:56 +00:00
}
2019-01-16 17:21:59 +00:00
@media (min-width: $bp__layout) {
padding: .5em 0;
2019-01-16 22:55:56 +00:00
&::before {
$size: .2rem;
content: '';
position: absolute;
height: $size;
width: $size;
right: 100%;
top: 50%;
transform: translateY(-50%);
margin-top: .02rem;
margin-right: .3rem;
border-radius: 50%;
2019-01-23 12:08:58 +00:00
background-color: $color__neutral-600;
2019-01-16 22:55:56 +00:00
transition: opacity .5s;
opacity: 0;
}
&.nuxt-link-active::before {
2019-01-16 22:55:56 +00:00
transition: opacity 1s .5s;
opacity: .8;
}
2019-01-16 17:21:59 +00:00
}
}
.site-nav__footer {
margin-top: 1.8em;
}
.social-nav {
2019-01-23 21:40:20 +00:00
z-index: 10;
2019-01-16 17:21:59 +00:00
list-style: none;
display: flex;
}
.social-nav__link {
display: block;
height: 2em;
width: 5ch;
2019-01-23 12:08:58 +00:00
transition: opacity .5s;
color: $color__neutral-900;
&:link, &:visited {
opacity: .8;
color: $color__neutral-900;
}
&:hover, &:active {
opacity: .5;
}
2019-01-16 22:55:56 +00:00
2019-01-16 17:21:59 +00:00
@media (min-width: $bp__layout) {
width: 3ch;
}
}
.social-nav__icon.icon {
justify-content: normal;
}
.footer-attr {
2019-01-23 12:08:58 +00:00
color: $color__neutral-600;
2019-01-16 17:21:59 +00:00
font-size: .7em;
2019-01-31 10:41:04 +00:00
@include font-body(600);
2019-01-16 17:21:59 +00:00
}
2019-01-16 21:09:55 +00:00
.menu-toggle {
$width: 2rem;
$margin: ($site-menu__header-width - $width) / 2;
2019-01-23 21:40:20 +00:00
z-index: 30;
2019-01-16 21:09:55 +00:00
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 {
2019-01-23 11:53:25 +00:00
$color: $color__neutral-900;
2019-01-16 21:09:55 +00:00
$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;
}
}
2019-01-23 21:40:20 +00:00
.menu-background {
2019-01-30 20:06:55 +00:00
display: none;
2019-01-23 21:40:20 +00:00
}
2019-01-30 20:06:55 +00:00
@media (min-width: $bp__layout) {
.menu-background {
z-index: 1;
display: initial;
2019-01-23 21:40:20 +00:00
position: absolute;
top: 0;
2019-01-30 20:06:55 +00:00
bottom: 0;
left: 0;
right: 0;
pointer-events: none;
2019-01-23 21:40:20 +00:00
2019-01-30 20:06:55 +00:00
@media (min-width: $bp__layout) {
right: $site-menu__header-width;
}
2019-01-23 21:40:20 +00:00
}
2019-01-30 20:06:55 +00:00
.menu-link-background {
background-size: cover;
background-position: center center;
transition: opacity .5s;
opacity: 0;
&::after {
$color: $site-menu__color-bg; //color of gradient overlay
content: '';
position: absolute;
width: 100%;
height: 100%;
left: 0;
top: 0;
background: linear-gradient(
to bottom,
rgba($color, 0),
rgba($color, .7),
rgba($color, .7),
rgba($color, 0)
),
linear-gradient(
to right,
rgba($color, 1),
rgba($color, .2) 50%,
rgba($color, 0) 90%,
rgba($color, 1)
),
linear-gradient(
to bottom,
rgba($color, 1),
rgba($color, 0) 20%,
rgba($color, 0) 80%,
rgba($color, 1) 90%,
rgba($color, 1)
);
}
2019-01-23 21:40:20 +00:00
}
2019-01-30 20:06:55 +00:00
.site-nav__item:hover .menu-link-background {
transition: opacity 1s;
opacity: .3;
}
2019-01-23 21:40:20 +00:00
2019-01-30 20:06:55 +00:00
.social-background {
2019-01-30 21:40:45 +00:00
filter: blur(3px);
2019-01-30 20:06:55 +00:00
transition: opacity .5s;
opacity: 0;
2019-01-23 21:40:20 +00:00
}
2019-01-30 20:06:55 +00:00
.social-background__icon {
position: absolute;
align-items: flex-end;
width: 100%;
height: 100%;
bottom: 0;
left: 0;
}
.social-nav-item:hover .social-background {
transition: opacity 1s;
opacity: .15;
}
2019-01-23 21:40:20 +00:00
}
2019-01-16 21:09:55 +00:00
2019-01-16 17:21:59 +00:00
</style>
<style lang="scss">
@media (min-width: $bp__layout) {
.menu-content .social-nav__icon i::before {
font-size: 1.1em;
2019-01-30 21:40:45 +00:00
filter: blur(20xp);
2019-01-16 17:21:59 +00:00
}
}
2019-01-23 21:40:20 +00:00
.social-background__icon i.mdi {
position: relative;
&::before {
font-size: 19em;
margin-bottom: -.05em;
@media (min-width: $bp__layout) {
margin-bottom: -.19em;
}
}
&::after {
content: '';
position: absolute;
width: 100%;
height: 100%;
top: 0;
left: 0;
background: linear-gradient(
to bottom,
rgba($site-menu__color-bg, .8),
rgba($site-menu__color-bg, 0)
);
}
}
2019-01-02 21:12:22 +00:00
</style>