aboutsummaryrefslogtreecommitdiff
path: root/src/components/List.vue
blob: 843370e085221bca4506df0ac98db76846a733b4 (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
41
42
43
44
45
46
47
<template>
  <ul class="list">
    <li
      v-for="item in items"
      :key="item.id"
      @click="$emit('selectionChanged', item)"
      class="list-item">
      <slot :item="item">{{ item }}</slot>
    </li>
  </ul>
</template>

<script>
export default {
  name: 'List',
  props: {
    items: Array,
  },
  emits: {
    selectionChanged: null,
  },
};
</script>

<style scoped>
.list {
  list-style-type: none;
}

.list-item {
  border-radius: 5px;
  margin: 5px 0;
  padding: 0.15em;
  text-align: center;
}

.list-item:hover {
  background-color: rgb(182, 182, 182);
}

@media (prefers-color-scheme: dark) {
  .list-item {
    background-color: #303030;
    color: white;
  }
}
</style>