2020-01-29 20:37:25 +01:00
|
|
|
<template>
|
2023-05-29 20:51:02 +02:00
|
|
|
<div v-if="visible" class="info" :class="{ warn, card }">
|
2023-04-08 02:01:42 +02:00
|
|
|
<i v-if="warn" class="ph-warning ph-bold ph-lg"></i>
|
2023-05-29 22:17:42 +02:00
|
|
|
<i
|
|
|
|
v-else
|
|
|
|
class="ph-bold ph-lg"
|
|
|
|
:class="icon ? `ph-${icon}` : 'ph-info'"
|
|
|
|
></i>
|
2023-04-08 02:01:42 +02:00
|
|
|
<slot></slot>
|
2023-05-29 22:17:42 +02:00
|
|
|
<button
|
|
|
|
v-if="closeable"
|
|
|
|
v-tooltip="i18n.ts.close"
|
2023-05-31 22:28:07 +02:00
|
|
|
class="_buttonIcon close"
|
2023-05-29 22:17:42 +02:00
|
|
|
@click.stop="close"
|
|
|
|
>
|
2023-05-29 20:51:02 +02:00
|
|
|
<i class="ph-x ph-bold ph-lg"></i>
|
|
|
|
</button>
|
2023-04-08 02:01:42 +02:00
|
|
|
</div>
|
2020-01-29 20:37:25 +01:00
|
|
|
</template>
|
|
|
|
|
2022-09-06 11:09:17 +02:00
|
|
|
<script lang="ts" setup>
|
2023-05-29 20:51:02 +02:00
|
|
|
import { ref } from "vue";
|
2023-05-29 21:19:53 +02:00
|
|
|
import { i18n } from "@/i18n";
|
2023-05-29 20:51:02 +02:00
|
|
|
|
|
|
|
const visible = ref(true);
|
2020-01-29 20:37:25 +01:00
|
|
|
|
2022-12-07 05:12:44 +01:00
|
|
|
defineProps<{
|
2023-05-29 15:11:42 +02:00
|
|
|
icon?: string;
|
2022-09-06 11:09:17 +02:00
|
|
|
warn?: boolean;
|
2023-05-29 15:11:42 +02:00
|
|
|
card?: boolean;
|
2023-05-29 20:55:00 +02:00
|
|
|
closeable?: boolean;
|
2022-09-06 11:09:17 +02:00
|
|
|
}>();
|
2023-05-29 20:51:02 +02:00
|
|
|
|
|
|
|
const emit = defineEmits<{
|
|
|
|
(ev: "close"): void;
|
|
|
|
}>();
|
|
|
|
|
|
|
|
function close() {
|
|
|
|
visible.value = false;
|
|
|
|
emit("close");
|
|
|
|
}
|
2020-01-29 20:37:25 +01:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
2023-05-29 15:11:42 +02:00
|
|
|
.info {
|
2020-01-29 20:37:25 +01:00
|
|
|
padding: 16px;
|
|
|
|
font-size: 90%;
|
|
|
|
background: var(--infoBg);
|
|
|
|
color: var(--infoFg);
|
2021-01-11 12:38:34 +01:00
|
|
|
border-radius: var(--radius);
|
2023-05-31 22:28:07 +02:00
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
gap: .4em;
|
2020-01-29 20:37:25 +01:00
|
|
|
|
|
|
|
&.warn {
|
|
|
|
background: var(--infoWarnBg);
|
|
|
|
color: var(--infoWarnFg);
|
|
|
|
}
|
|
|
|
|
2023-05-29 15:11:42 +02:00
|
|
|
&.card {
|
2023-05-31 22:28:07 +02:00
|
|
|
display: inline;
|
2023-05-29 15:11:42 +02:00
|
|
|
background: var(--panel);
|
|
|
|
color: var(--fg);
|
|
|
|
padding: 48px;
|
|
|
|
font-size: 1em;
|
|
|
|
text-align: center;
|
|
|
|
> i {
|
|
|
|
display: block;
|
|
|
|
font-size: 4em;
|
|
|
|
margin: 0;
|
|
|
|
}
|
|
|
|
> :deep(*) {
|
|
|
|
margin-inline: auto;
|
|
|
|
}
|
|
|
|
> :deep(:not(:last-child)) {
|
|
|
|
margin-bottom: 20px;
|
|
|
|
}
|
|
|
|
> :deep(p) {
|
|
|
|
max-width: 30em;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-01-29 20:37:25 +01:00
|
|
|
> i {
|
|
|
|
margin-right: 4px;
|
|
|
|
}
|
2023-05-29 20:51:02 +02:00
|
|
|
> .close {
|
|
|
|
margin-left: auto;
|
|
|
|
float: right;
|
|
|
|
}
|
2020-01-29 20:37:25 +01:00
|
|
|
}
|
|
|
|
</style>
|