monacousa-portal/components/dashboard/QuickActionCard.vue

163 lines
3.5 KiB
Vue

<template>
<div
v-motion
:initial="{ opacity: 0, y: 20, scale: 0.9 }"
:enter="{
opacity: 1,
y: 0,
scale: 1,
transition: {
delay: delay,
duration: 500,
type: 'spring',
stiffness: 200
}
}"
:hovered="{
scale: 1.05,
y: -5,
transition: {
duration: 200
}
}"
class="quick-action-card"
@click="$emit('click')"
>
<div class="action-icon" :style="{ background: iconBackground }">
<v-icon :color="color" size="28">{{ icon }}</v-icon>
</div>
<h4 class="action-title">{{ title }}</h4>
<v-icon class="action-arrow" color="grey" size="16">mdi-arrow-right</v-icon>
</div>
</template>
<script setup lang="ts">
import { computed } from 'vue';
interface Props {
icon: string;
title: string;
color?: string;
delay?: number;
}
const props = withDefaults(defineProps<Props>(), {
color: 'error',
delay: 0
});
defineEmits<{
click: [];
}>();
// Compute icon background based on color
const iconBackground = computed(() => {
const colors: Record<string, string> = {
error: 'linear-gradient(135deg, rgba(220, 38, 38, 0.1), rgba(220, 38, 38, 0.05))',
primary: 'linear-gradient(135deg, rgba(33, 150, 243, 0.1), rgba(33, 150, 243, 0.05))',
success: 'linear-gradient(135deg, rgba(34, 197, 94, 0.1), rgba(34, 197, 94, 0.05))',
warning: 'linear-gradient(135deg, rgba(245, 158, 11, 0.1), rgba(245, 158, 11, 0.05))',
info: 'linear-gradient(135deg, rgba(59, 130, 246, 0.1), rgba(59, 130, 246, 0.05))'
};
return colors[props.color] || colors.error;
});
</script>
<style scoped lang="scss">
.quick-action-card {
position: relative;
background: linear-gradient(135deg,
rgba(255, 255, 255, 0.95),
rgba(255, 255, 255, 0.85)
);
backdrop-filter: blur(20px);
-webkit-backdrop-filter: blur(20px);
border-radius: 1rem;
border: 1px solid rgba(255, 255, 255, 0.3);
box-shadow:
0 8px 24px rgba(0, 0, 0, 0.06),
inset 0 1px 0 rgba(255, 255, 255, 0.5);
padding: 1.5rem;
cursor: pointer;
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
overflow: hidden;
&::before {
content: '';
position: absolute;
top: 0;
left: 0;
right: 0;
height: 3px;
background: linear-gradient(90deg,
rgba(220, 38, 38, 0.3),
rgba(220, 38, 38, 0.1),
transparent
);
transform: translateX(-100%);
transition: transform 0.3s ease;
}
&:hover {
border-color: rgba(220, 38, 38, 0.2);
box-shadow:
0 12px 32px rgba(0, 0, 0, 0.1),
inset 0 1px 0 rgba(255, 255, 255, 0.7);
&::before {
transform: translateX(0);
}
.action-arrow {
transform: translateX(4px);
color: rgb(220, 38, 38) !important;
}
.action-icon {
transform: rotate(-5deg) scale(1.1);
}
}
}
.action-icon {
width: 56px;
height: 56px;
border-radius: 12px;
display: flex;
align-items: center;
justify-content: center;
margin-bottom: 1rem;
transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}
.action-title {
font-size: 0.9375rem;
font-weight: 600;
color: rgb(31, 41, 55);
margin: 0;
line-height: 1.4;
}
.action-arrow {
position: absolute;
top: 1.5rem;
right: 1.5rem;
transition: all 0.3s ease;
}
@media (max-width: 640px) {
.quick-action-card {
padding: 1rem;
}
.action-icon {
width: 48px;
height: 48px;
}
.action-title {
font-size: 0.875rem;
}
}
</style>