-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathAppSection.vue
102 lines (86 loc) · 1.69 KB
/
AppSection.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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
<!--
section that spans width of page and contains, aligns, and evenly vertically
spaces its contents. all page content should be contained within one of these.
-->
<template>
<section :class="['section', width, design, alignment, { inset }, { node }]">
<slot />
</section>
</template>
<script setup lang="ts">
type Props = {
/** width of section */
width?: "full" | "medium" | "big";
/** visual design */
design?: "normal" | "fill" | "bare";
alignment?: "left" | "center";
inset?: boolean;
node?: boolean;
};
withDefaults(defineProps<Props>(), {
width: "medium",
design: "normal",
alignment: "center",
inset: false,
});
type Slots = {
default: () => unknown;
};
defineSlots<Slots>();
</script>
<style lang="scss" scoped>
.section {
display: flex;
flex-direction: column;
transition: background $fast;
&.center {
align-items: center;
gap: 40px;
text-align: center;
}
&.left {
align-items: flex-start;
gap: 20px;
text-align: left;
}
&.full {
padding: 30px 20px;
}
&.node {
margin: 10px 20px 10px $toc-width + 20px !important;
}
&.inset {
padding: 30px 20px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}
&.left {
margin: 10px 20px;
}
&.medium {
&.center {
padding: 30px max(20px, calc((100% - $section) / 2));
}
&.left {
padding: 5px 15px;
}
}
&.big {
padding: 30px 20px;
//padding: 30px max(20px, calc((100% - $section-big) / 2));
}
&.normal {
&:nth-child(odd) {
background: $white;
}
&:nth-child(even) {
background: $off-white;
}
}
&.fill {
background: $theme-light;
}
&:last-of-type {
flex-grow: 1;
}
}
</style>