aboutsummaryrefslogtreecommitdiff
path: root/data/vue/Section.vue
blob: 6977ac6c2698c4628b9656f0ca188013106553f7 (plain)
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
<template>
  <h2 class="section_header" @click="section_toggle">
    {{ name }} <span class="section_button">{{ visible ? '-' : '+' }}</span>
  </h2>
  <div :class="{ section_grid: grid }" v-show="visible">
    <slot></slot>
  </div>
</template>

<script setup>
import { defineProps, ref } from 'vue'

const props = defineProps({ name: String, grid: Boolean })
const visible = ref(true)
const section_toggle = () => visible.value = !visible.value
</script>

<style>
.section_header {
  border-bottom: 1px solid #586e75;
  cursor: pointer;
  font-size: 18px;
  font-weight: normal;
}

.section_button {
  font-family: monospace;
}

.section_grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
}

@media screen and (max-width: 800px) {
  .section_grid {
    grid-template-columns: 1fr;
  }
}
</style>