-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathHeading.vue
47 lines (42 loc) · 1.08 KB
/
Heading.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
<template>
<div
v-if="title"
class="flex items-center justify-between border-b border-dividerLight p-4"
>
<div class="flex flex-1 items-center justify-start">
<slot name="actions"></slot>
</div>
<div class="flex items-center justify-center">
<h3 class="heading">
{{ title }}
</h3>
</div>
<div class="flex flex-1 items-center justify-end">
<HoppButton
v-if="showCloseIcon"
v-tippy="{ theme: 'tooltip', delay: [500, 20] }"
:title="closeText ?? t?.('action.close') ?? 'Close'"
:icon="IconX"
@click="close"
/>
</div>
</div>
</template>
<script setup lang="ts">
import { inject } from "vue"
import { HOPP_UI_OPTIONS, HoppUIPluginOptions } from "./../../plugin"
import IconX from "~icons/lucide/x"
import { HoppButton } from "./../button"
const { t } = inject<HoppUIPluginOptions>(HOPP_UI_OPTIONS) ?? {}
defineProps<{
title: string
showCloseIcon?: boolean
closeText?: string | null
}>()
const emit = defineEmits<{
(e: "close"): void
}>()
const close = () => {
emit("close")
}
</script>