-
Notifications
You must be signed in to change notification settings - Fork 128
/
MainSection.vue
executable file
·70 lines (69 loc) · 1.61 KB
/
MainSection.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<template>
<main class="section page-main-section">
<div class="container">
<div class="columns">
<aside
v-if="computedTheme === 'sidebar-left'"
class="column left-sidebar is-one-quarter"
>
<slot name="sidebar"></slot>
</aside>
<div
:class="{
column: true,
'is-full': computedTheme === 'one-column' && !oneColumnConstrained,
'is-offset-2':
oneColumnConstrained && computedTheme === 'one-column',
'is-8': oneColumnConstrained && computedTheme === 'one-column',
'is-three-quarters': computedTheme !== 'one-column'
}"
>
<slot></slot>
</div>
<aside
v-if="computedTheme === 'sidebar-right'"
class="column right-sidebar is-one-quarter"
>
<slot name="sidebar"></slot>
</aside>
</div>
</div>
</main>
</template>
<script>
export default {
name: 'MainSection',
props: {
oneColumnConstrained: { type: Boolean, default: false },
theme: { type: String, default: '' }
},
computed: {
computedTheme() {
if (this.theme) {
return this.theme
}
if (this.$siteConfig.layout.theme) {
return this.$siteConfig.layout.theme
}
return 'one-column'
}
}
}
</script>
<style lang="scss">
.page-main-section {
margin-top: 52px;
}
.hero + .page-main-section {
margin-top: initial;
}
.is-one-quarter {
padding: 0 20px;
&.right-sidebar {
border-left: 1px solid #eee;
}
&.left-sidebar {
border-right: 1px solid #eee;
}
}
</style>