ModalContainer.vue 1.26 KB
Newer Older
abergavenny's avatar
abergavenny committed
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
<script setup>
defineEmits(['closeModal'])
defineProps(['label', 'permanent'])
</script>

<template>
  <div class="modal-container">
    <div class="modal-content shadow">
      <div v-if="!permanent" class="modal-content__title">
        <div class="headline">
          <span>{{ label }}</span>
        </div>
        <button class="button primary" type="button" @click="$emit('closeModal')">
          <font-awesome-icon icon="fa-solid fa-xmark" />
        </button>
      </div>
      <slot />
    </div>
  </div>
</template>

<style scoped>
.modal-container {
  overflow: hidden;
  position: fixed;
  background-color: hsl(var(--clr-background) / 0.8);
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  padding: var(--spacing);
  height: auto;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1;
}

@media (min-width: 48em) {

}

.modal-content {
  overflow-y: auto;
  background-color: hsl(var(--clr-content));
  width: min(50em, 100%);
  height: 100%;
  display: flex;
  flex-direction: column;
  border-radius: var(--radius);
}

@media (min-width: 48em) {
  .modal-content {
    overflow: hidden;
    height: 90%;
  }
}

.modal-content__title {
  padding: var(--spacing);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
</style>