<!--
SPDX-FileCopyrightText: syuilo and other misskey contributors
SPDX-License-Identifier: AGPL-3.0-only
-->

<template>
<div :class="[$style.root, { [$style.h]: ['3', '4', '5'].includes(variation), [$style.v]: ['1', '2'].includes(variation) }]">
	<img :src="`/client-assets/mahjong/putted-tile-${variation}.png`" :class="$style.bg"/>
	<img :src="`/client-assets/mahjong/tiles/${tile}.png`" :class="$style.fg"/>
</div>
</template>

<script lang="ts" setup>
import { computed, onActivated, onDeactivated, onMounted, onUnmounted, ref, shallowRef, triggerRef, watch } from 'vue';
import * as Mahjong from 'misskey-mahjong';

const props = defineProps<{
	tile: Mahjong.Common.Tile;
	variation: string;
}>();
</script>

<style lang="scss" module>
.root {
	display: inline-block;
	position: relative;
	width: 72px;
	height: 72px;
	margin: -17px;
}
.h {
	margin: -14px -20px -10px -20px;
}
.v {
	margin: -14px -20px -10px -20px;
}
.bg {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
}
.fg {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	margin: auto;
	width: 53%;
	height: 53%;
	object-fit: contain;
}
</style>
