2023-01-09 20:35:36 +09:00
|
|
|
<template>
|
|
|
|
<div class="_panel">
|
2023-04-01 13:46:04 +09:00
|
|
|
<div :class="$style.container" :style="{ backgroundImage: instance.bannerUrl ? `url(${ instance.bannerUrl })` : null }">
|
2023-01-09 20:35:36 +09:00
|
|
|
<div :class="$style.iconContainer">
|
2023-04-01 13:46:04 +09:00
|
|
|
<img :src="instance.iconUrl ?? instance.faviconUrl ?? '/favicon.ico'" alt="" :class="$style.icon"/>
|
2023-01-09 20:35:36 +09:00
|
|
|
</div>
|
|
|
|
<div :class="$style.bodyContainer">
|
|
|
|
<div :class="$style.body">
|
2023-04-01 13:46:04 +09:00
|
|
|
<MkA :class="$style.name" to="/about" behavior="window">{{ instance.name }}</MkA>
|
2023-01-09 20:35:36 +09:00
|
|
|
<div :class="$style.host">{{ host }}</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts" setup>
|
2023-02-16 23:09:41 +09:00
|
|
|
import { useWidgetPropsManager, Widget, WidgetComponentExpose } from './widget';
|
2023-01-09 20:35:36 +09:00
|
|
|
import { GetFormResultType } from '@/scripts/form';
|
|
|
|
import { host } from '@/config';
|
2023-04-01 13:46:04 +09:00
|
|
|
import { instance } from '@/instance';
|
2023-01-09 20:35:36 +09:00
|
|
|
|
|
|
|
const name = 'instanceInfo';
|
|
|
|
|
|
|
|
const widgetPropsDef = {
|
|
|
|
};
|
|
|
|
|
|
|
|
type WidgetProps = GetFormResultType<typeof widgetPropsDef>;
|
|
|
|
|
|
|
|
// 現時点ではvueの制限によりimportしたtypeをジェネリックに渡せない
|
|
|
|
//const props = defineProps<WidgetComponentProps<WidgetProps>>();
|
|
|
|
//const emit = defineEmits<WidgetComponentEmits<WidgetProps>>();
|
|
|
|
const props = defineProps<{ widget?: Widget<WidgetProps>; }>();
|
|
|
|
const emit = defineEmits<{ (ev: 'updateProps', props: WidgetProps); }>();
|
|
|
|
|
|
|
|
const { widgetProps, configure } = useWidgetPropsManager(name,
|
|
|
|
widgetPropsDef,
|
|
|
|
props,
|
|
|
|
emit,
|
|
|
|
);
|
|
|
|
|
|
|
|
defineExpose<WidgetComponentExpose>({
|
|
|
|
name,
|
|
|
|
configure,
|
|
|
|
id: props.widget ? props.widget.id : null,
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" module>
|
|
|
|
.container {
|
|
|
|
position: relative;
|
|
|
|
background-size: cover;
|
|
|
|
background-position: center;
|
|
|
|
display: flex;
|
|
|
|
}
|
|
|
|
|
|
|
|
.iconContainer {
|
|
|
|
display: inline-block;
|
|
|
|
text-align: center;
|
|
|
|
padding: 16px;
|
|
|
|
}
|
|
|
|
|
|
|
|
.icon {
|
|
|
|
display: inline-block;
|
|
|
|
width: 60px;
|
|
|
|
height: 60px;
|
|
|
|
border-radius: 8px;
|
|
|
|
box-sizing: border-box;
|
|
|
|
border: solid 3px #fff;
|
|
|
|
}
|
|
|
|
|
|
|
|
.bodyContainer {
|
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
min-width: 0;
|
|
|
|
padding: 0 16px 0 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
.body {
|
|
|
|
text-overflow: ellipsis;
|
|
|
|
overflow: clip;
|
|
|
|
}
|
|
|
|
|
|
|
|
.name {
|
|
|
|
color: #fff;
|
|
|
|
filter: drop-shadow(0 0 4px #000);
|
|
|
|
font-weight: bold;
|
|
|
|
}
|
|
|
|
|
|
|
|
.host {
|
|
|
|
color: #fff;
|
|
|
|
filter: drop-shadow(0 0 4px #000);
|
|
|
|
}
|
|
|
|
</style>
|