summaryrefslogtreecommitdiff
path: root/packages/frontend/src/components/MkFukidashi.vue
blob: fba5dc854c9cabef307366318f391d71d8898d7b (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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
<!--
SPDX-FileCopyrightText: syuilo and other misskey contributors
SPDX-License-Identifier: AGPL-3.0-only
-->

<template>
<div
	:class="[
		$style.root,
		tail === 'left' ? $style.left : $style.right,
		negativeMargin === true && $style.negativeMargin,
		shadow === true && $style.shadow,
		accented === true && $style.accented
	]"
>
	<div :class="$style.bg">
		<svg v-if="tail !== 'none'" :class="$style.tail" version="1.1" viewBox="0 0 14.597 14.58" xmlns="http://www.w3.org/2000/svg">
			<g transform="translate(-173.71 -87.184)">
				<path d="m188.19 87.657c-1.469 2.3218-3.9315 3.8312-6.667 4.0865-2.2309-1.7379-4.9781-2.6816-7.8061-2.6815h-5.1e-4v12.702h12.702v-5.1e-4c2e-5 -1.9998-0.47213-3.9713-1.378-5.754 2.0709-1.6834 3.2732-4.2102 3.273-6.8791-6e-5 -0.49375-0.0413-0.98662-0.1235-1.4735z" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round" stroke-width=".33225" style="paint-order:stroke fill markers"/>
			</g>
		</svg>
		<div :class="$style.content">
			<slot></slot>
		</div>
	</div>
</div>
</template>

<script setup lang="ts">
withDefaults(defineProps<{
	tail?: 'left' | 'right' | 'none';
	negativeMargin?: boolean;
	shadow?: boolean;
	accented?: boolean;
}>(), {
	tail: 'right',
	negativeMargin: false,
	shadow: false,
	accented: false,
});
</script>

<style module lang="scss">
.root {
	--fukidashi-radius: var(--MI-radius);
	--fukidashi-bg: var(--MI_THEME-panel);

	position: relative;
	display: inline-block;
	min-height: calc(var(--fukidashi-radius) * 2);
	padding-top: calc(var(--fukidashi-radius) * .13);

	&.accented {
		--fukidashi-bg: color-mix(in srgb, var(--MI_THEME-accent), var(--MI_THEME-panel) 85%);
	}

	&.shadow {
		filter: drop-shadow(0 4px 32px var(--MI_THEME-shadow));
	}

	&.left {
		padding-left: calc(var(--fukidashi-radius) * .13);

		&.negativeMargin {
			margin-left: calc(calc(var(--fukidashi-radius) * .13) * -1);
		}
	}

	&.right {
		padding-right: calc(var(--fukidashi-radius) * .13);

		&.negativeMargin {
			margin-right: calc(calc(var(--fukidashi-radius) * .13) * -1);
		}
	}
}

.bg {
	width: 100%;
	height: 100%;
	background: var(--fukidashi-bg);
	border-radius: var(--fukidashi-radius);
}

.content {
	position: relative;
	padding: 10px 14px;
}

@container (max-width: 450px) {
	.content {
		padding: 8px 12px;
	}
}

.tail {
	position: absolute;
	top: 0;
	display: block;
	width: calc(var(--fukidashi-radius) * 1.13);
	height: auto;
	fill: var(--fukidashi-bg);
}

.left .tail {
	left: 0;
	transform: rotateY(180deg);
}

.right .tail {
	right: 0;
}
</style>