2018-08-11 01:47:10 -04:00
|
|
|
<template>
|
2018-12-08 02:48:15 -05:00
|
|
|
<section class="section fd-content">
|
2018-08-11 01:47:10 -04:00
|
|
|
<div class="container">
|
|
|
|
<div class="columns is-centered">
|
|
|
|
<div class="column is-four-fifths">
|
2020-10-06 11:15:02 -04:00
|
|
|
<section v-if="$slots['options']">
|
2022-02-19 00:18:01 -05:00
|
|
|
<div style="height: 1px;" ref="options_ref" />
|
2020-10-06 11:15:02 -04:00
|
|
|
<slot name="options"></slot>
|
|
|
|
<nav class="buttons is-centered" style="margin-bottom: 6px; margin-top: 16px;">
|
2020-10-07 03:03:02 -04:00
|
|
|
<a v-if="!options_visible" class="button is-small is-white" @click="scroll_to_top"><span class="icon is-small"><i class="mdi mdi-chevron-up"></i></span></a>
|
|
|
|
<a v-else class="button is-small is-white" @click="scroll_to_content"><span class="icon is-small"><i class="mdi mdi-chevron-down"></i></span></a>
|
2020-10-06 11:15:02 -04:00
|
|
|
</nav>
|
|
|
|
</section>
|
2020-10-07 03:03:02 -04:00
|
|
|
<div :class="{'fd-content-with-option': $slots['options']}">
|
|
|
|
<nav class="level" id="top">
|
|
|
|
<!-- Left side -->
|
|
|
|
<div class="level-left">
|
|
|
|
<div class="level-item has-text-centered-mobile">
|
|
|
|
<div>
|
|
|
|
<slot name="heading-left"></slot>
|
|
|
|
</div>
|
2018-08-11 01:47:10 -04:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
2020-10-07 03:03:02 -04:00
|
|
|
<!-- Right side -->
|
|
|
|
<div class="level-right has-text-centered-mobile">
|
|
|
|
<slot name="heading-right"></slot>
|
|
|
|
</div>
|
|
|
|
</nav>
|
|
|
|
|
|
|
|
<slot name="content"></slot>
|
|
|
|
<div style="margin-top: 16px;">
|
|
|
|
<slot name="footer"></slot>
|
2018-08-11 01:47:10 -04:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</section>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2020-10-06 11:15:02 -04:00
|
|
|
export default {
|
|
|
|
name: 'ContentWithHeading',
|
|
|
|
|
2020-10-07 03:03:02 -04:00
|
|
|
data () {
|
|
|
|
return {
|
2022-02-19 00:18:01 -05:00
|
|
|
options_visible: false
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
mounted() {
|
|
|
|
if (this.$slots['options']) {
|
|
|
|
this.observer = new IntersectionObserver(
|
|
|
|
this.onElementObserved,
|
|
|
|
{
|
|
|
|
rootMargin: '-82px 0px 0px 0px',
|
|
|
|
threshold: 1.0
|
2020-10-07 03:03:02 -04:00
|
|
|
}
|
2022-02-19 00:18:01 -05:00
|
|
|
)
|
|
|
|
this.observer.observe(this.$refs.options_ref)
|
2020-10-07 03:03:02 -04:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2020-10-06 11:15:02 -04:00
|
|
|
methods: {
|
2022-02-19 00:18:01 -05:00
|
|
|
onElementObserved(entries) {
|
|
|
|
entries.forEach(({ target, isIntersecting}) => {
|
|
|
|
this.options_visible = isIntersecting
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
2020-10-06 11:15:02 -04:00
|
|
|
scroll_to_top: function () {
|
|
|
|
window.scrollTo({ top: 0, behavior: 'smooth' })
|
2020-10-07 03:03:02 -04:00
|
|
|
},
|
|
|
|
|
|
|
|
scroll_to_content: function () {
|
|
|
|
// window.scrollTo({ top: 80, behavior: 'smooth' })
|
|
|
|
if (this.$route.meta.has_tabs) {
|
|
|
|
this.$scrollTo('#top', { offset: -140 })
|
|
|
|
} else {
|
|
|
|
this.$scrollTo('#top', { offset: -100 })
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
visibilityChanged: function (isVisible) {
|
|
|
|
this.options_visible = isVisible
|
2020-10-06 11:15:02 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2018-08-11 01:47:10 -04:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<style>
|
|
|
|
</style>
|