2023-07-07 19:22:30 +00:00
|
|
|
<template>
|
2023-07-23 13:31:28 +00:00
|
|
|
<div v-if="visible" class="info" :class="{ warn, card }">
|
|
|
|
<i v-if="warn" class="ph-warning ph-bold ph-lg"></i>
|
|
|
|
<i
|
|
|
|
v-else
|
|
|
|
class="ph-bold ph-lg"
|
|
|
|
:class="icon ? `ph-${icon}` : 'ph-info'"
|
|
|
|
></i>
|
|
|
|
<slot></slot>
|
|
|
|
<button
|
|
|
|
v-if="closeable"
|
|
|
|
v-tooltip="i18n.ts.close"
|
|
|
|
class="_buttonIcon close"
|
|
|
|
@click.stop="close"
|
|
|
|
>
|
|
|
|
<i class="ph-x ph-bold ph-lg"></i>
|
|
|
|
</button>
|
|
|
|
</div>
|
2023-07-07 19:22:30 +00:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts" setup>
|
|
|
|
import { ref } from "vue";
|
|
|
|
import { i18n } from "@/i18n";
|
|
|
|
|
|
|
|
const visible = ref(true);
|
|
|
|
|
|
|
|
defineProps<{
|
2023-07-23 13:31:28 +00:00
|
|
|
icon?: string;
|
|
|
|
warn?: boolean;
|
|
|
|
card?: boolean;
|
|
|
|
closeable?: boolean;
|
2023-07-07 19:22:30 +00:00
|
|
|
}>();
|
|
|
|
|
|
|
|
const emit = defineEmits<{
|
2023-07-23 13:31:28 +00:00
|
|
|
(ev: "close"): void;
|
2023-07-07 19:22:30 +00:00
|
|
|
}>();
|
|
|
|
|
|
|
|
function close() {
|
2023-07-23 13:31:28 +00:00
|
|
|
visible.value = false;
|
|
|
|
emit("close");
|
2023-07-07 19:22:30 +00:00
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
.info {
|
2023-07-23 13:31:28 +00:00
|
|
|
padding: 16px;
|
|
|
|
font-size: 90%;
|
|
|
|
background: var(--infoBg);
|
|
|
|
color: var(--infoFg);
|
|
|
|
border-radius: var(--radius);
|
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
gap: 0.4em;
|
2023-07-07 19:22:30 +00:00
|
|
|
|
2023-07-23 13:31:28 +00:00
|
|
|
&.warn {
|
|
|
|
background: var(--infoWarnBg);
|
|
|
|
color: var(--infoWarnFg);
|
|
|
|
}
|
2023-07-07 19:22:30 +00:00
|
|
|
|
2023-07-23 13:31:28 +00:00
|
|
|
&.card {
|
|
|
|
display: block;
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|
2023-07-07 19:22:30 +00:00
|
|
|
|
2023-07-23 13:31:28 +00:00
|
|
|
> i {
|
|
|
|
margin-right: 4px;
|
|
|
|
}
|
|
|
|
> .close {
|
|
|
|
margin-left: auto;
|
|
|
|
float: right;
|
|
|
|
}
|
2023-07-07 19:22:30 +00:00
|
|
|
}
|
|
|
|
</style>
|