summaryrefslogtreecommitdiff
path: root/packages/frontend/src/ui/_common_/titlebar.vue
blob: d0c1e4c6238705a07a642d25ad950e58f28ec781 (plain)
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
<!--
SPDX-FileCopyrightText: syuilo and misskey-project
SPDX-License-Identifier: AGPL-3.0-only
-->

<template>
<div :class="$style.root">
	<div :class="$style.title">
		<img :src="instance.sidebarLogoUrl || instance.iconUrl || instance.faviconUrl || '/favicon.ico'" alt="" :class="instance.sidebarLogoUrl ? $style.wideInstanceIcon : $style.instanceIcon"/>
		<span :class="$style.instanceTitle">{{ instance.name ?? webHost }}</span>
	</div>
	<div :class="$style.controls">
		<span :class="$style.left">
			<button v-if="canBack" class="_button" :class="$style.button" @click="goBack"><i class="ti ti-arrow-left"></i></button>
		</span>
		<span :class="$style.right">
		</span>
	</div>
</div>
</template>

<script lang="ts" setup>
import { webHost } from '@@/js/config.js';
import { ref } from 'vue';
import { instance } from '@/instance.js';
import { prefer } from '@/preferences.js';

const canBack = ref(true);

function goBack() {
	window.history.back();
}
</script>

<style lang="scss" module>
.root {
	--height: 36px;

	background: var(--MI_THEME-navBg);
	height: var(--height);
	font-size: 90%;
}

.title {
	display: flex;
	justify-content: center;
	align-items: center;
	text-align: center;
	height: var(--height);
}

.controls {
	position: absolute;
	top: 0;
	left: 0;
	display: flex;
	justify-content: center;
	align-items: center;
	height: var(--height);
}

.instanceIcon {
	display: inline-block;
	width: 20px;
	aspect-ratio: 1;
	border-radius: 5px;
	margin-right: 8px;
}

.wideInstanceIcon {
	display: inline-block;
	min-width: 38px;
	max-width: 100%;
	max-height: var(--height);
}

.instanceTitle {
	display: inline-block;
}

.left {
	margin-right: auto;
}

.right {
	margin-left: auto;
}

.button {
	display: inline-block;
	height: var(--height);
	aspect-ratio: 1;
}
</style>