You've already forked AstralRinth
forked from didirus/AstralRinth
* refactor: migrate to common eslint+prettier configs * fix: prettier frontend * feat: config changes * fix: lint issues * fix: lint * fix: type imports * fix: cyclical import issue * fix: lockfile * fix: missing dep * fix: switch to tabs * fix: continue switch to tabs * fix: rustfmt parity * fix: moderation lint issue * fix: lint issues * fix: ui intl * fix: lint issues * Revert "fix: rustfmt parity" This reverts commit cb99d2376c321d813d4b7fc7e2a213bb30a54711. * feat: revert last rs
68 lines
1.5 KiB
Vue
68 lines
1.5 KiB
Vue
<script setup lang="ts">
|
|
import { ref } from 'vue'
|
|
|
|
withDefaults(
|
|
defineProps<{
|
|
selected?: boolean
|
|
tooltip?: string
|
|
}>(),
|
|
{
|
|
selected: false,
|
|
tooltip: undefined,
|
|
},
|
|
)
|
|
|
|
const emit = defineEmits<{ (e: 'click', event: MouseEvent): void }>()
|
|
|
|
const pressed = ref(false)
|
|
</script>
|
|
|
|
<template>
|
|
<div
|
|
v-tooltip="tooltip ?? undefined"
|
|
class="group relative overflow-hidden rounded-xl border-2 transition-all duration-200"
|
|
:class="[selected ? 'border-brand' : 'border-transparent hover:border-inverted']"
|
|
>
|
|
<button
|
|
class="skin-btn-bg absolute inset-0 cursor-pointer p-0 border-none group-hover:brightness-125 transition-all duration-200"
|
|
:class="selected ? 'selected' : ''"
|
|
@mousedown="pressed = true"
|
|
@mouseup="pressed = false"
|
|
@mouseleave="pressed = false"
|
|
@click="(e) => emit('click', e)"
|
|
></button>
|
|
|
|
<div
|
|
class="relative w-full h-full flex flex-col items-center justify-center pointer-events-none z-10"
|
|
>
|
|
<div v-if="$slots.icon" class="mb-2">
|
|
<slot name="icon" />
|
|
</div>
|
|
<span class="text-md text-center px-2 text-primary">
|
|
<slot />
|
|
</span>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
|
|
<style scoped lang="scss">
|
|
.skin-btn-bg {
|
|
background: var(--color-gradient-button-bg);
|
|
}
|
|
|
|
.skin-btn-bg.selected {
|
|
background: linear-gradient(
|
|
157.61deg,
|
|
var(--color-brand) -76.68%,
|
|
rgba(27, 217, 106, 0.534) -38.61%,
|
|
rgba(12, 89, 44, 0.6) 100.4%
|
|
),
|
|
var(--color-bg);
|
|
}
|
|
|
|
.skin-btn-bg.selected:hover,
|
|
.group:hover .skin-btn-bg.selected {
|
|
filter: brightness(1.15);
|
|
}
|
|
</style>
|