222 lines
4.7 KiB
Vue
222 lines
4.7 KiB
Vue
<script setup lang="ts">
|
|
import ModuleIcon from '@/components/ModuleIcon.vue'
|
|
|
|
withDefaults(
|
|
defineProps<{
|
|
title: string
|
|
tone: 'blue' | 'orange' | 'green' | 'teal'
|
|
icon: 'detect' | 'metal' | 'soil' | 'water'
|
|
caption?: string
|
|
index?: string
|
|
}>(),
|
|
{},
|
|
)
|
|
|
|
defineEmits<{
|
|
click: []
|
|
}>()
|
|
</script>
|
|
|
|
<template>
|
|
<button
|
|
class="module-button"
|
|
:class="`module-button--${tone}`"
|
|
type="button"
|
|
@click="$emit('click')"
|
|
>
|
|
<span class="module-button__icon">
|
|
<ModuleIcon :name="icon" />
|
|
</span>
|
|
<span v-if="index" class="module-button__index">{{ index }}</span>
|
|
|
|
<span class="module-button__body">
|
|
<span class="module-button__label">{{ title }}</span>
|
|
<span v-if="caption" class="module-button__caption">{{ caption }}</span>
|
|
</span>
|
|
|
|
<span class="module-button__bar" aria-hidden="true"></span>
|
|
</button>
|
|
</template>
|
|
|
|
<style scoped>
|
|
.module-button {
|
|
--tone-1: #6fb0ff;
|
|
--tone-2: #2f6fd0;
|
|
--tone-glow: rgba(70, 140, 255, 0.28);
|
|
--tone-line: rgba(111, 176, 255, 0.55);
|
|
position: relative;
|
|
display: block;
|
|
height: 252px;
|
|
overflow: hidden;
|
|
border: 1px solid rgba(255, 255, 255, 0.09);
|
|
border-radius: 20px;
|
|
text-align: left;
|
|
background:
|
|
radial-gradient(135% 105% at 106% -6%, var(--tone-glow) 0%, transparent 52%),
|
|
linear-gradient(
|
|
158deg,
|
|
rgba(255, 255, 255, 0.08) 0%,
|
|
rgba(255, 255, 255, 0.02) 58%,
|
|
rgba(255, 255, 255, 0.045) 100%
|
|
);
|
|
box-shadow:
|
|
0 18px 40px rgba(1, 8, 24, 0.42),
|
|
inset 0 1px 0 rgba(255, 255, 255, 0.1);
|
|
transition:
|
|
transform 0.3s cubic-bezier(0.22, 1, 0.36, 1),
|
|
border-color 0.3s ease,
|
|
box-shadow 0.3s ease;
|
|
}
|
|
|
|
/* 悬停时从左上扫过的高光 */
|
|
.module-button::before {
|
|
content: '';
|
|
position: absolute;
|
|
inset: -40% -70%;
|
|
background: linear-gradient(
|
|
115deg,
|
|
transparent 42%,
|
|
rgba(255, 255, 255, 0.14) 50%,
|
|
transparent 58%
|
|
);
|
|
transform: translateX(-62%);
|
|
transition: transform 0.85s ease;
|
|
pointer-events: none;
|
|
}
|
|
|
|
.module-button:hover {
|
|
border-color: var(--tone-line);
|
|
box-shadow:
|
|
0 26px 52px rgba(1, 8, 24, 0.55),
|
|
0 0 0 1px var(--tone-glow),
|
|
0 0 34px var(--tone-glow),
|
|
inset 0 1px 0 rgba(255, 255, 255, 0.14);
|
|
transform: translateY(-6px);
|
|
}
|
|
|
|
.module-button:hover::before {
|
|
transform: translateX(62%);
|
|
}
|
|
|
|
.module-button:active {
|
|
transform: translateY(-2px) scale(0.995);
|
|
}
|
|
|
|
.module-button--blue {
|
|
--tone-1: #6fb0ff;
|
|
--tone-2: #2f6fd0;
|
|
--tone-glow: rgba(70, 140, 255, 0.28);
|
|
--tone-line: rgba(111, 176, 255, 0.55);
|
|
}
|
|
|
|
.module-button--orange {
|
|
--tone-1: #ffd166;
|
|
--tone-2: #e08f00;
|
|
--tone-glow: rgba(255, 176, 32, 0.24);
|
|
--tone-line: rgba(255, 203, 92, 0.5);
|
|
}
|
|
|
|
.module-button--green {
|
|
--tone-1: #a4e56f;
|
|
--tone-2: #4f9a26;
|
|
--tone-glow: rgba(118, 200, 60, 0.22);
|
|
--tone-line: rgba(164, 229, 111, 0.5);
|
|
}
|
|
|
|
.module-button--teal {
|
|
--tone-1: #5ce3d6;
|
|
--tone-2: #109c91;
|
|
--tone-glow: rgba(40, 200, 188, 0.24);
|
|
--tone-line: rgba(92, 227, 214, 0.5);
|
|
}
|
|
|
|
.module-button__icon {
|
|
position: absolute;
|
|
top: 26px;
|
|
left: 28px;
|
|
display: grid;
|
|
place-items: center;
|
|
width: 86px;
|
|
height: 86px;
|
|
border-radius: 22px;
|
|
color: #f4f9ff;
|
|
background: linear-gradient(150deg, var(--tone-1) 0%, var(--tone-2) 100%);
|
|
box-shadow:
|
|
0 14px 28px var(--tone-glow),
|
|
inset 0 1px 0 rgba(255, 255, 255, 0.4);
|
|
transition:
|
|
transform 0.3s cubic-bezier(0.22, 1, 0.36, 1),
|
|
box-shadow 0.3s ease;
|
|
}
|
|
|
|
.module-button__icon :deep(svg) {
|
|
width: 52px;
|
|
height: 52px;
|
|
filter: drop-shadow(0 2px 6px rgba(4, 16, 40, 0.35));
|
|
}
|
|
|
|
.module-button:hover .module-button__icon {
|
|
box-shadow:
|
|
0 18px 34px var(--tone-glow),
|
|
inset 0 1px 0 rgba(255, 255, 255, 0.45);
|
|
transform: scale(1.06);
|
|
}
|
|
|
|
.module-button__index {
|
|
position: absolute;
|
|
top: 24px;
|
|
right: 28px;
|
|
color: rgba(255, 255, 255, 0.1);
|
|
font-size: 46px;
|
|
font-variant-numeric: tabular-nums;
|
|
font-weight: 700;
|
|
letter-spacing: 2px;
|
|
line-height: 1;
|
|
}
|
|
|
|
.module-button__body {
|
|
position: absolute;
|
|
right: 28px;
|
|
bottom: 32px;
|
|
left: 28px;
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 8px;
|
|
}
|
|
|
|
.module-button__label {
|
|
color: #f3f8ff;
|
|
font-size: 30px;
|
|
font-weight: 600;
|
|
letter-spacing: 3px;
|
|
line-height: 1.25;
|
|
text-shadow: 0 2px 12px rgba(2, 10, 30, 0.45);
|
|
}
|
|
|
|
.module-button__caption {
|
|
color: var(--tone-1);
|
|
font-size: 12px;
|
|
font-weight: 600;
|
|
letter-spacing: 2.6px;
|
|
opacity: 0.85;
|
|
text-transform: uppercase;
|
|
}
|
|
|
|
.module-button__bar {
|
|
position: absolute;
|
|
bottom: 0;
|
|
left: 0;
|
|
width: 42%;
|
|
height: 3px;
|
|
border-radius: 0 3px 3px 0;
|
|
background: linear-gradient(90deg, var(--tone-1), transparent);
|
|
opacity: 0.55;
|
|
transition: width 0.4s ease, opacity 0.3s ease;
|
|
}
|
|
|
|
.module-button:hover .module-button__bar {
|
|
width: 100%;
|
|
opacity: 1;
|
|
}
|
|
</style>
|