marc-leopold/components/ContentPage.vue

129 lines
2.0 KiB
Vue
Raw Normal View History

2019-01-03 14:06:28 +00:00
<template>
2019-02-02 13:53:19 +00:00
<article class="content-page"
:class="{ 'is-mounted': isMounted }"
>
2019-01-27 21:36:28 +00:00
<h1 v-if="heading !== ''" class="page-heading page-title">{{ heading }}</h1>
2019-02-02 13:53:19 +00:00
<section class="content-container load-transition">
<div v-if="$slots.default" class="content">
2019-01-03 18:15:02 +00:00
<slot></slot>
</div>
2019-01-03 14:06:28 +00:00
</section>
<div v-if="$slots.background" class="background">
<slot name="background"></slot>
2019-01-03 14:49:25 +00:00
</div>
2019-01-14 11:06:38 +00:00
</article>
2019-01-03 14:06:28 +00:00
</template>
<script>
export default {
props: {
heading: {
type: String,
2019-01-24 09:44:26 +00:00
required: false,
default: '',
2019-01-03 14:06:28 +00:00
}
},
data () {
return {
2019-02-02 13:53:19 +00:00
isMounted: false,
2019-01-03 14:06:28 +00:00
}
},
2019-02-02 13:53:19 +00:00
mounted () {
this.$nextTick(() => {
this.isMounted = true
})
},
2019-01-03 14:06:28 +00:00
}
</script>
<style lang="scss" scoped>
2019-01-03 17:52:38 +00:00
$z-index-bottom: 5;
$z-index-top: 10;
2019-01-03 14:06:28 +00:00
.content-page {
2019-01-03 17:52:38 +00:00
display: flex;
flex-direction: column;
2019-01-03 14:06:28 +00:00
width: 100%;
height: 100%;
padding: $site-menu__header-width 0 0 0;
2019-01-30 17:43:09 +00:00
overflow-y: auto;
2019-01-03 14:06:28 +00:00
@media (min-width: $bp__layout) {
padding: 0 0 0 $site-menu__header-width;
2019-01-30 17:43:09 +00:00
overflow-y: hidden;
2019-01-03 14:06:28 +00:00
}
2019-01-27 15:52:30 +00:00
background-color: $color__neutral-100;
2019-01-03 14:06:28 +00:00
}
2019-01-03 14:49:25 +00:00
.content-container {
2019-01-03 17:52:38 +00:00
z-index: $z-index-top;
2019-01-03 14:49:25 +00:00
position: relative;
2019-01-03 17:52:38 +00:00
height: 100%;
2019-01-03 18:15:02 +00:00
width: 100%;
2019-01-03 17:52:38 +00:00
@media (min-width: $bp__layout) {
position: absolute;
top: 0;
right: 0;
2019-01-30 17:43:09 +00:00
overflow-y: auto;
overflow-x: hidden;
2019-01-03 17:52:38 +00:00
}
2019-01-03 14:49:25 +00:00
}
2019-01-03 18:15:02 +00:00
.content {
position: absolute;
2019-01-30 21:21:55 +00:00
display: flex;
align-items: stretch;
justify-content: stretch;
2019-01-03 18:15:02 +00:00
width: 100%;
2019-01-27 18:26:13 +00:00
min-height: 100%;
2019-01-03 18:15:02 +00:00
top: 0;
right: 0;
2019-01-27 15:52:30 +00:00
padding: .5rem 1rem 2rem;
2019-01-03 18:32:11 +00:00
2019-01-03 18:15:02 +00:00
@media (min-width: $bp__layout) {
width: 50%;
2019-01-24 09:44:26 +00:00
padding: 1rem;
2019-01-03 18:32:11 +00:00
2019-01-27 15:52:30 +00:00
background-color: rgba(0, 0, 0, .5);
2019-01-03 18:15:02 +00:00
}
2019-01-03 18:32:11 +00:00
color: #fff; // TEMP
2019-01-03 18:15:02 +00:00
}
2019-01-03 17:52:38 +00:00
.page-heading {
2019-02-17 15:21:32 +00:00
z-index: $z-index-top + 5;
2019-01-03 17:52:38 +00:00
position: relative;
2019-01-03 14:49:25 +00:00
}
.background {
z-index: $z-index-bottom;
2019-01-03 14:49:25 +00:00
position: absolute;
width: 100%;
height: 100%;
top: 0;
left: 0;
2019-01-27 15:52:30 +00:00
opacity: .5;
@media (min-width: $bp__layout) {
opacity: 1;
}
2019-01-03 14:49:25 +00:00
}
2019-02-02 13:53:19 +00:00
.load-transition {
transition: 2s 2s;
opacity: 0;
@at-root .is-mounted & {
opacity: 1;
}
}
2019-01-03 14:06:28 +00:00
</style>