-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
/
two-cols-header.vue
67 lines (63 loc) · 1.12 KB
/
two-cols-header.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
<!--
Usage:
```md
---
layout: two-cols-header
---
This spans both
::left::
# Left
This shows on the left
::right::
# Right
This shows on the right
::bottom::
This shows at the bottom, aligned to the end (bottom) of the grid
```
-->
<script setup lang="ts">
const props = defineProps({
class: {
type: String,
},
layoutClass: {
type: String,
},
})
</script>
<template>
<div class="slidev-layout two-cols-header w-full h-full" :class="layoutClass">
<div class="col-header">
<slot />
</div>
<div class="col-left" :class="props.class">
<slot name="left" />
</div>
<div class="col-right" :class="props.class">
<slot name="right" />
</div>
<div class="col-bottom" :class="props.class">
<slot name="bottom" />
</div>
</div>
</template>
<style scoped>
.two-cols-header {
display: grid;
grid-template-columns: repeat(2, 1fr);
grid-template-rows: repeat(2, 1fr);
}
.col-header {
grid-area: 1 / 1 / 2 / 3;
}
.col-left {
grid-area: 2 / 1 / 3 / 2;
}
.col-right {
grid-area: 2 / 2 / 3 / 3;
}
.col-bottom {
align-self: end;
grid-area: 3 / 1 / 3 / 3;
}
</style>