Implement MonacoUSA Portal redesign foundations
Some checks failed
Build And Push Image / docker (push) Failing after 1m11s

- Added VueUse Motion for animations with custom presets
- Created base UI component library with glass morphism effects:
  * GlassCard - Flexible card component with 4 variants
  * MonacoButton - Multi-variant button system
  * FloatingInput - Modern input with floating labels
  * StatsCard - Dashboard statistics display
  * AnimatedNumber - Smooth number animations
  * Icon system - Modular icon components
- Created comprehensive page mockups:
  * Dashboard mockup with stats, activity feed, and widgets
  * Events page with filtering, search, and calendar
- Established Monaco brand design system (red #dc2626)
- Configured spring animations and glass effects

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-08-30 18:25:21 +02:00
parent de75d2d764
commit c39936984b
29 changed files with 7278 additions and 1 deletions

View File

@@ -0,0 +1,64 @@
<template>
<span>{{ displayValue }}</span>
</template>
<script setup lang="ts">
import { ref, watch, onMounted } from 'vue'
interface Props {
value: number
duration?: number
format?: (value: number) => string
delay?: number
}
const props = withDefaults(defineProps<Props>(), {
duration: 1000,
format: (value: number) => value.toLocaleString(),
delay: 0
})
const displayValue = ref(props.format(0))
const startTimestamp = ref<number | null>(null)
const startValue = ref(0)
const animate = (timestamp: number) => {
if (!startTimestamp.value) {
startTimestamp.value = timestamp
}
const progress = Math.min((timestamp - startTimestamp.value) / props.duration, 1)
// Easing function for smooth animation
const easeOutQuart = (t: number) => 1 - Math.pow(1 - t, 4)
const easedProgress = easeOutQuart(progress)
const currentValue = startValue.value + (props.value - startValue.value) * easedProgress
displayValue.value = props.format(currentValue)
if (progress < 1) {
requestAnimationFrame(animate)
}
}
const startAnimation = () => {
startTimestamp.value = null
if (props.delay > 0) {
setTimeout(() => {
requestAnimationFrame(animate)
}, props.delay)
} else {
requestAnimationFrame(animate)
}
}
watch(() => props.value, (newValue, oldValue) => {
startValue.value = oldValue || 0
startAnimation()
})
onMounted(() => {
startAnimation()
})
</script>

View File

@@ -0,0 +1,417 @@
<template>
<div
class="floating-input"
:class="[
`floating-input--${variant}`,
{
'floating-input--focused': isFocused || modelValue,
'floating-input--error': error,
'floating-input--disabled': disabled
}
]"
>
<div class="floating-input__wrapper">
<Icon
v-if="leftIcon"
:name="leftIcon"
class="floating-input__icon floating-input__icon--left"
/>
<input
:id="inputId"
v-model="modelValue"
:type="type"
:disabled="disabled"
:readonly="readonly"
:autocomplete="autocomplete"
class="floating-input__field"
:class="{
'floating-input__field--with-left-icon': leftIcon,
'floating-input__field--with-right-icon': rightIcon || clearable
}"
@focus="handleFocus"
@blur="handleBlur"
@input="$emit('update:modelValue', $event.target.value)"
/>
<label
:for="inputId"
class="floating-input__label"
:class="{
'floating-input__label--floating': isFocused || modelValue,
'floating-input__label--with-icon': leftIcon
}"
>
{{ label }}
<span v-if="required" class="floating-input__required">*</span>
</label>
<button
v-if="clearable && modelValue"
type="button"
class="floating-input__clear"
@click="clearInput"
>
<Icon name="x" />
</button>
<Icon
v-if="rightIcon && !clearable"
:name="rightIcon"
class="floating-input__icon floating-input__icon--right"
/>
</div>
<Transition name="message">
<div v-if="error || helperText" class="floating-input__message">
<Icon
v-if="error"
name="alert-circle"
class="floating-input__message-icon"
/>
<span>{{ error || helperText }}</span>
</div>
</Transition>
</div>
</template>
<script setup lang="ts">
import { ref, computed } from 'vue'
import Icon from '~/components/ui/Icon.vue'
interface Props {
modelValue?: string
label: string
type?: 'text' | 'email' | 'password' | 'tel' | 'url' | 'number'
variant?: 'glass' | 'solid' | 'outline'
leftIcon?: string
rightIcon?: string
error?: string
helperText?: string
required?: boolean
disabled?: boolean
readonly?: boolean
clearable?: boolean
autocomplete?: string
}
const props = withDefaults(defineProps<Props>(), {
type: 'text',
variant: 'glass',
required: false,
disabled: false,
readonly: false,
clearable: false,
autocomplete: 'off'
})
const emit = defineEmits<{
'update:modelValue': [value: string]
'focus': []
'blur': []
'clear': []
}>()
const isFocused = ref(false)
const inputId = computed(() => `input-${Math.random().toString(36).substr(2, 9)}`)
const handleFocus = () => {
isFocused.value = true
emit('focus')
}
const handleBlur = () => {
isFocused.value = false
emit('blur')
}
const clearInput = () => {
emit('update:modelValue', '')
emit('clear')
}
</script>
<style scoped lang="scss">
.floating-input {
position: relative;
width: 100%;
&__wrapper {
position: relative;
display: flex;
align-items: center;
border-radius: 12px;
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
// Base styles
.floating-input--glass & {
background: rgba(255, 255, 255, 0.7);
backdrop-filter: blur(20px);
-webkit-backdrop-filter: blur(20px);
border: 2px solid rgba(255, 255, 255, 0.3);
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.05);
&:hover:not(.floating-input--disabled &) {
background: rgba(255, 255, 255, 0.8);
border-color: rgba(220, 38, 38, 0.2);
box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
}
}
.floating-input--solid & {
background: white;
border: 2px solid #e5e5e5;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
&:hover:not(.floating-input--disabled &) {
border-color: #d4d4d4;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}
}
.floating-input--outline & {
background: transparent;
border: 2px solid #d4d4d4;
&:hover:not(.floating-input--disabled &) {
border-color: #a3a3a3;
}
}
// Focus state
.floating-input--focused & {
border-color: #dc2626;
box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
transform: translateY(-1px);
.floating-input--glass& {
background: rgba(255, 255, 255, 0.9);
}
}
// Error state
.floating-input--error & {
border-color: #ef4444;
box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}
// Disabled state
.floating-input--disabled & {
opacity: 0.5;
cursor: not-allowed;
}
}
&__field {
flex: 1;
padding: 1.25rem 1rem 0.5rem;
background: transparent;
border: none;
outline: none;
font-size: 1rem;
color: #27272a;
transition: padding 0.2s ease;
&--with-left-icon {
padding-left: 3rem;
}
&--with-right-icon {
padding-right: 3rem;
}
&:disabled {
cursor: not-allowed;
}
// Remove autofill background
&:-webkit-autofill {
-webkit-box-shadow: 0 0 0 1000px transparent inset;
-webkit-text-fill-color: #27272a;
transition: background-color 5000s ease-in-out 0s;
}
}
&__label {
position: absolute;
left: 1rem;
top: 50%;
transform: translateY(-50%);
font-size: 1rem;
color: #71717a;
pointer-events: none;
transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
background: transparent;
padding: 0 0.25rem;
&--with-icon {
left: 3rem;
}
&--floating {
top: 0.75rem;
transform: translateY(0);
font-size: 0.75rem;
color: #dc2626;
font-weight: 500;
.floating-input--glass & {
background: linear-gradient(
to bottom,
rgba(255, 255, 255, 0.9) 0%,
rgba(255, 255, 255, 0.9) 50%,
transparent 50%,
transparent 100%
);
}
.floating-input--solid & {
background: linear-gradient(
to bottom,
white 0%,
white 50%,
transparent 50%,
transparent 100%
);
}
}
.floating-input--error &--floating {
color: #ef4444;
}
}
&__required {
color: #ef4444;
margin-left: 0.125rem;
}
&__icon {
position: absolute;
width: 1.25rem;
height: 1.25rem;
color: #dc2626;
&--left {
left: 1rem;
}
&--right {
right: 1rem;
}
}
&__clear {
position: absolute;
right: 1rem;
display: flex;
align-items: center;
justify-content: center;
width: 1.5rem;
height: 1.5rem;
padding: 0;
background: rgba(220, 38, 38, 0.1);
border: none;
border-radius: 50%;
color: #dc2626;
cursor: pointer;
transition: all 0.2s ease;
&:hover {
background: rgba(220, 38, 38, 0.2);
transform: scale(1.1);
}
svg {
width: 0.875rem;
height: 0.875rem;
}
}
&__message {
display: flex;
align-items: center;
gap: 0.25rem;
margin-top: 0.5rem;
font-size: 0.875rem;
color: #71717a;
.floating-input--error & {
color: #ef4444;
}
}
&__message-icon {
width: 1rem;
height: 1rem;
flex-shrink: 0;
}
}
// Animations
.message-enter-active,
.message-leave-active {
transition: all 0.2s ease;
}
.message-enter-from {
opacity: 0;
transform: translateY(-4px);
}
.message-leave-to {
opacity: 0;
transform: translateY(-4px);
}
// Dark mode support
@media (prefers-color-scheme: dark) {
.floating-input {
&__field {
color: white;
&:-webkit-autofill {
-webkit-text-fill-color: white;
}
}
&__wrapper {
.floating-input--glass & {
background: rgba(30, 30, 30, 0.7);
border-color: rgba(255, 255, 255, 0.1);
}
.floating-input--solid & {
background: #27272a;
border-color: #3f3f46;
}
}
&__label {
color: #a3a3a3;
&--floating {
.floating-input--glass & {
background: linear-gradient(
to bottom,
rgba(30, 30, 30, 0.9) 0%,
rgba(30, 30, 30, 0.9) 50%,
transparent 50%,
transparent 100%
);
}
.floating-input--solid & {
background: linear-gradient(
to bottom,
#27272a 0%,
#27272a 50%,
transparent 50%,
transparent 100%
);
}
}
}
}
}
</style>

276
components/ui/GlassCard.vue Normal file
View File

@@ -0,0 +1,276 @@
<template>
<div
v-motion
:initial="animated ? animationConfig.initial : {}"
:enter="animated ? animationConfig.enter : {}"
:hovered="hoverable ? { scale: 1.02 } : {}"
:delay="delay"
class="glass-card"
:class="[
`glass-card--${variant}`,
`glass-card--${size}`,
{
'glass-card--clickable': clickable,
'glass-card--elevated': elevated
}
]"
>
<div v-if="hasHeader" class="glass-card__header">
<slot name="header">
<h3 v-if="title" class="glass-card__title">{{ title }}</h3>
<p v-if="subtitle" class="glass-card__subtitle">{{ subtitle }}</p>
</slot>
</div>
<div class="glass-card__body">
<slot />
</div>
<div v-if="hasFooter" class="glass-card__footer">
<slot name="footer" />
</div>
<div v-if="gradient" class="glass-card__gradient"></div>
</div>
</template>
<script setup lang="ts">
import { computed, useSlots } from 'vue'
interface Props {
title?: string
subtitle?: string
variant?: 'light' | 'dark' | 'colored' | 'gradient'
size?: 'sm' | 'md' | 'lg' | 'xl'
clickable?: boolean
hoverable?: boolean
elevated?: boolean
gradient?: boolean
animated?: boolean
delay?: number
}
const props = withDefaults(defineProps<Props>(), {
variant: 'light',
size: 'md',
clickable: false,
hoverable: true,
elevated: true,
gradient: false,
animated: true,
delay: 0
})
const slots = useSlots()
const hasHeader = computed(() => !!slots.header || props.title || props.subtitle)
const hasFooter = computed(() => !!slots.footer)
const animationConfig = {
initial: {
opacity: 0,
y: 20,
scale: 0.95
},
enter: {
opacity: 1,
y: 0,
scale: 1,
transition: {
type: 'spring',
stiffness: 200,
damping: 20
}
}
}
</script>
<style scoped lang="scss">
.glass-card {
position: relative;
border-radius: 20px;
overflow: hidden;
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
// Glass effect base
&::before {
content: '';
position: absolute;
inset: 0;
border-radius: inherit;
padding: 1px;
background: linear-gradient(135deg,
rgba(255, 255, 255, 0.3) 0%,
rgba(255, 255, 255, 0.1) 100%);
-webkit-mask:
linear-gradient(#fff 0 0) content-box,
linear-gradient(#fff 0 0);
-webkit-mask-composite: xor;
mask-composite: exclude;
pointer-events: none;
}
// Variants
&--light {
background: rgba(255, 255, 255, 0.7);
backdrop-filter: blur(20px) saturate(180%);
-webkit-backdrop-filter: blur(20px) saturate(180%);
border: 1px solid rgba(255, 255, 255, 0.3);
color: #27272a;
}
&--dark {
background: rgba(0, 0, 0, 0.7);
backdrop-filter: blur(20px) saturate(180%);
-webkit-backdrop-filter: blur(20px) saturate(180%);
border: 1px solid rgba(255, 255, 255, 0.1);
color: #ffffff;
}
&--colored {
background: linear-gradient(135deg,
rgba(220, 38, 38, 0.1) 0%,
rgba(185, 28, 28, 0.05) 100%);
backdrop-filter: blur(20px) saturate(180%);
-webkit-backdrop-filter: blur(20px) saturate(180%);
border: 1px solid rgba(220, 38, 38, 0.2);
color: #27272a;
}
&--gradient {
background: linear-gradient(135deg,
rgba(255, 255, 255, 0.8) 0%,
rgba(255, 255, 255, 0.4) 100%);
backdrop-filter: blur(20px) saturate(180%);
-webkit-backdrop-filter: blur(20px) saturate(180%);
border: 1px solid rgba(255, 255, 255, 0.4);
color: #27272a;
}
// Sizes
&--sm {
.glass-card__body {
padding: 1rem;
}
.glass-card__header {
padding: 1rem 1rem 0.5rem;
}
.glass-card__footer {
padding: 0.5rem 1rem 1rem;
}
}
&--md {
.glass-card__body {
padding: 1.5rem;
}
.glass-card__header {
padding: 1.5rem 1.5rem 0.75rem;
}
.glass-card__footer {
padding: 0.75rem 1.5rem 1.5rem;
}
}
&--lg {
.glass-card__body {
padding: 2rem;
}
.glass-card__header {
padding: 2rem 2rem 1rem;
}
.glass-card__footer {
padding: 1rem 2rem 2rem;
}
}
&--xl {
.glass-card__body {
padding: 2.5rem;
}
.glass-card__header {
padding: 2.5rem 2.5rem 1.25rem;
}
.glass-card__footer {
padding: 1.25rem 2.5rem 2.5rem;
}
}
// States
&--clickable {
cursor: pointer;
&:active {
transform: scale(0.98);
}
}
&--elevated {
box-shadow:
0 10px 40px rgba(0, 0, 0, 0.1),
0 2px 10px rgba(0, 0, 0, 0.05),
inset 0 1px 0 rgba(255, 255, 255, 0.5);
&:hover {
box-shadow:
0 20px 60px rgba(0, 0, 0, 0.15),
0 4px 15px rgba(0, 0, 0, 0.08),
inset 0 1px 0 rgba(255, 255, 255, 0.6);
}
}
&:hover {
transform: translateY(-2px);
}
// Header
&__header {
border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}
&__title {
font-size: 1.25rem;
font-weight: 600;
margin: 0;
color: #dc2626;
}
&__subtitle {
font-size: 0.875rem;
margin: 0.25rem 0 0;
opacity: 0.8;
}
// Body
&__body {
position: relative;
z-index: 1;
}
// Footer
&__footer {
border-top: 1px solid rgba(255, 255, 255, 0.2);
}
// Gradient overlay
&__gradient {
position: absolute;
top: 0;
right: 0;
width: 50%;
height: 100%;
background: linear-gradient(90deg,
transparent 0%,
rgba(220, 38, 38, 0.05) 100%);
pointer-events: none;
}
}
// Dark mode support
@media (prefers-color-scheme: dark) {
.glass-card--light {
background: rgba(30, 30, 30, 0.7);
border-color: rgba(255, 255, 255, 0.1);
color: #ffffff;
}
}
</style>

49
components/ui/Icon.vue Normal file
View File

@@ -0,0 +1,49 @@
<template>
<component
:is="iconComponent"
v-if="iconComponent"
v-bind="$attrs"
/>
<span v-else class="icon-placeholder">
{{ name }}
</span>
</template>
<script setup lang="ts">
import { computed, defineAsyncComponent } from 'vue'
interface Props {
name: string
}
const props = defineProps<Props>()
// Map common icon names to Heroicons components
// This is a simplified version - in production you'd import the actual icons
const iconMap: Record<string, any> = {
'chevron-down': defineAsyncComponent(() => import('./icons/ChevronDownIcon.vue')),
'chevron-up': defineAsyncComponent(() => import('./icons/ChevronUpIcon.vue')),
'x': defineAsyncComponent(() => import('./icons/XIcon.vue')),
'check': defineAsyncComponent(() => import('./icons/CheckIcon.vue')),
'alert-circle': defineAsyncComponent(() => import('./icons/AlertCircleIcon.vue')),
'trending-up': defineAsyncComponent(() => import('./icons/TrendingUpIcon.vue')),
'trending-down': defineAsyncComponent(() => import('./icons/TrendingDownIcon.vue')),
'minus': defineAsyncComponent(() => import('./icons/MinusIcon.vue')),
}
const iconComponent = computed(() => iconMap[props.name])
</script>
<style scoped>
.icon-placeholder {
display: inline-flex;
align-items: center;
justify-content: center;
width: 1em;
height: 1em;
font-size: 0.75em;
color: currentColor;
background: rgba(220, 38, 38, 0.1);
border-radius: 4px;
}
</style>

View File

@@ -0,0 +1,329 @@
<template>
<button
v-motion
:initial="animated ? { scale: 0.95, opacity: 0 } : {}"
:enter="animated ? { scale: 1, opacity: 1 } : {}"
:hovered="hoverable ? { scale: 1.05 } : {}"
:tapped="{ scale: 0.95 }"
:delay="delay"
class="monaco-button"
:class="[
`monaco-button--${variant}`,
`monaco-button--${size}`,
{
'monaco-button--block': block,
'monaco-button--loading': loading,
'monaco-button--icon-only': !$slots.default && icon
}
]"
:disabled="disabled || loading"
@click="$emit('click', $event)"
>
<span v-if="loading" class="monaco-button__spinner">
<svg class="monaco-button__spinner-svg" viewBox="0 0 24 24">
<circle
class="monaco-button__spinner-circle"
cx="12"
cy="12"
r="10"
stroke-width="3"
fill="none"
/>
</svg>
</span>
<Icon
v-if="icon && !loading"
:name="icon"
class="monaco-button__icon"
:class="{ 'monaco-button__icon--left': $slots.default }"
/>
<span v-if="$slots.default" class="monaco-button__content">
<slot />
</span>
<Icon
v-if="rightIcon && !loading"
:name="rightIcon"
class="monaco-button__icon monaco-button__icon--right"
/>
</button>
</template>
<script setup lang="ts">
import Icon from '~/components/ui/Icon.vue'
interface Props {
variant?: 'primary' | 'secondary' | 'glass' | 'gradient' | 'outline' | 'ghost'
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl'
icon?: string
rightIcon?: string
block?: boolean
disabled?: boolean
loading?: boolean
hoverable?: boolean
animated?: boolean
delay?: number
}
const props = withDefaults(defineProps<Props>(), {
variant: 'primary',
size: 'md',
block: false,
disabled: false,
loading: false,
hoverable: true,
animated: true,
delay: 0
})
defineEmits<{
click: [event: MouseEvent]
}>()
</script>
<style scoped lang="scss">
.monaco-button {
position: relative;
display: inline-flex;
align-items: center;
justify-content: center;
gap: 0.5rem;
font-weight: 600;
border-radius: 12px;
cursor: pointer;
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
outline: none;
border: none;
overflow: hidden;
// Create shimmer effect for gradient variant
&::before {
content: '';
position: absolute;
top: 0;
left: -100%;
width: 100%;
height: 100%;
background: linear-gradient(
90deg,
transparent,
rgba(255, 255, 255, 0.2),
transparent
);
transition: left 0.5s;
}
&:hover::before {
left: 100%;
}
// Variants
&--primary {
background: #dc2626;
color: white;
box-shadow: 0 4px 14px rgba(220, 38, 38, 0.25);
&:hover:not(:disabled) {
background: #b91c1c;
box-shadow: 0 6px 20px rgba(220, 38, 38, 0.35);
transform: translateY(-2px);
}
&:active:not(:disabled) {
transform: translateY(0);
}
}
&--secondary {
background: white;
color: #dc2626;
box-shadow: 0 4px 14px rgba(0, 0, 0, 0.1);
&:hover:not(:disabled) {
background: #fef2f2;
box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
transform: translateY(-2px);
}
}
&--glass {
background: rgba(255, 255, 255, 0.7);
backdrop-filter: blur(20px);
-webkit-backdrop-filter: blur(20px);
border: 1px solid rgba(255, 255, 255, 0.3);
color: #dc2626;
box-shadow:
0 8px 32px rgba(0, 0, 0, 0.1),
inset 0 1px 0 rgba(255, 255, 255, 0.5);
&:hover:not(:disabled) {
background: rgba(255, 255, 255, 0.8);
border-color: rgba(220, 38, 38, 0.2);
box-shadow:
0 12px 40px rgba(0, 0, 0, 0.15),
inset 0 1px 0 rgba(255, 255, 255, 0.6);
transform: translateY(-2px);
}
}
&--gradient {
background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
color: white;
box-shadow: 0 4px 14px rgba(220, 38, 38, 0.25);
&:hover:not(:disabled) {
background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
box-shadow: 0 6px 20px rgba(220, 38, 38, 0.35);
transform: translateY(-2px);
}
}
&--outline {
background: transparent;
color: #dc2626;
border: 2px solid #dc2626;
&:hover:not(:disabled) {
background: rgba(220, 38, 38, 0.1);
border-color: #b91c1c;
transform: translateY(-2px);
}
}
&--ghost {
background: transparent;
color: #dc2626;
&:hover:not(:disabled) {
background: rgba(220, 38, 38, 0.1);
transform: translateY(-2px);
}
}
// Sizes
&--xs {
padding: 0.25rem 0.5rem;
font-size: 0.75rem;
border-radius: 8px;
}
&--sm {
padding: 0.375rem 0.75rem;
font-size: 0.875rem;
border-radius: 10px;
}
&--md {
padding: 0.5rem 1rem;
font-size: 1rem;
}
&--lg {
padding: 0.75rem 1.5rem;
font-size: 1.125rem;
border-radius: 14px;
}
&--xl {
padding: 1rem 2rem;
font-size: 1.25rem;
border-radius: 16px;
}
// States
&--block {
width: 100%;
}
&--icon-only {
aspect-ratio: 1;
padding: 0;
&.monaco-button--xs { width: 1.75rem; }
&.monaco-button--sm { width: 2rem; }
&.monaco-button--md { width: 2.5rem; }
&.monaco-button--lg { width: 3rem; }
&.monaco-button--xl { width: 3.5rem; }
}
&:disabled {
opacity: 0.5;
cursor: not-allowed;
}
&--loading {
color: transparent;
pointer-events: none;
}
// Icons
&__icon {
width: 1.25em;
height: 1.25em;
flex-shrink: 0;
&--left {
margin-right: 0.25rem;
}
&--right {
margin-left: 0.25rem;
}
}
// Spinner
&__spinner {
position: absolute;
inset: 0;
display: flex;
align-items: center;
justify-content: center;
}
&__spinner-svg {
width: 1.5em;
height: 1.5em;
animation: spin 1s linear infinite;
}
&__spinner-circle {
stroke: currentColor;
stroke-linecap: round;
stroke-dasharray: 64;
stroke-dashoffset: 64;
animation: dash 1.5s ease-in-out infinite;
}
}
// Animations
@keyframes spin {
to { transform: rotate(360deg); }
}
@keyframes dash {
0% { stroke-dashoffset: 64; }
50% { stroke-dashoffset: 16; }
100% { stroke-dashoffset: 64; }
}
// Dark mode support
@media (prefers-color-scheme: dark) {
.monaco-button {
&--secondary {
background: #27272a;
color: #dc2626;
&:hover:not(:disabled) {
background: #3f3f46;
}
}
&--glass {
background: rgba(30, 30, 30, 0.7);
border-color: rgba(255, 255, 255, 0.1);
}
}
}
</style>

369
components/ui/StatsCard.vue Normal file
View File

@@ -0,0 +1,369 @@
<template>
<div
v-motion
:initial="{ opacity: 0, y: 20 }"
:enter="{
opacity: 1,
y: 0,
transition: {
delay: delay * 100,
type: 'spring',
stiffness: 200,
damping: 20
}
}"
class="stats-card"
:class="[
`stats-card--${variant}`,
{ 'stats-card--clickable': clickable }
]"
@click="$emit('click')"
>
<div class="stats-card__header">
<div class="stats-card__icon-wrapper">
<Icon
:name="icon"
class="stats-card__icon"
/>
</div>
<div v-if="trend" class="stats-card__trend" :class="`stats-card__trend--${trend.type}`">
<Icon
:name="trend.type === 'up' ? 'trending-up' : trend.type === 'down' ? 'trending-down' : 'minus'"
class="stats-card__trend-icon"
/>
<span>{{ trend.value }}%</span>
</div>
</div>
<div class="stats-card__content">
<h3 class="stats-card__label">{{ label }}</h3>
<div class="stats-card__value-wrapper">
<span v-if="prefix" class="stats-card__prefix">{{ prefix }}</span>
<AnimatedNumber
:value="value"
:duration="1500"
:format="format"
class="stats-card__value"
/>
<span v-if="suffix" class="stats-card__suffix">{{ suffix }}</span>
</div>
<p v-if="description" class="stats-card__description">{{ description }}</p>
</div>
<div v-if="progress !== undefined" class="stats-card__progress">
<div class="stats-card__progress-bar">
<div
class="stats-card__progress-fill"
:style="{ width: `${Math.min(100, Math.max(0, progress))}%` }"
/>
</div>
<span class="stats-card__progress-label">{{ progress }}% Complete</span>
</div>
<div v-if="sparkline" class="stats-card__sparkline">
<svg
viewBox="0 0 100 40"
preserveAspectRatio="none"
class="stats-card__sparkline-svg"
>
<polyline
:points="sparklinePoints"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
/>
<polyline
:points="`${sparklinePoints} 100,40 0,40`"
fill="currentColor"
fill-opacity="0.1"
/>
</svg>
</div>
</div>
</template>
<script setup lang="ts">
import { computed } from 'vue'
import Icon from '~/components/ui/Icon.vue'
import AnimatedNumber from '~/components/ui/AnimatedNumber.vue'
interface Trend {
type: 'up' | 'down' | 'neutral'
value: number
}
interface Props {
label: string
value: number
icon: string
variant?: 'glass' | 'solid' | 'gradient' | 'outline'
prefix?: string
suffix?: string
description?: string
trend?: Trend
progress?: number
sparkline?: number[]
clickable?: boolean
format?: (value: number) => string
delay?: number
}
const props = withDefaults(defineProps<Props>(), {
variant: 'glass',
clickable: false,
delay: 0,
format: (value: number) => value.toLocaleString()
})
defineEmits<{
click: []
}>()
const sparklinePoints = computed(() => {
if (!props.sparkline || props.sparkline.length === 0) return ''
const data = props.sparkline
const max = Math.max(...data)
const min = Math.min(...data)
const range = max - min || 1
return data
.map((value, index) => {
const x = (index / (data.length - 1)) * 100
const y = 40 - ((value - min) / range) * 35
return `${x},${y}`
})
.join(' ')
})
</script>
<style scoped lang="scss">
.stats-card {
position: relative;
padding: 1.5rem;
border-radius: 16px;
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
overflow: hidden;
// Glass variant
&--glass {
background: rgba(255, 255, 255, 0.7);
backdrop-filter: blur(20px);
-webkit-backdrop-filter: blur(20px);
border: 1px solid rgba(255, 255, 255, 0.3);
box-shadow:
0 8px 32px rgba(0, 0, 0, 0.08),
inset 0 1px 0 rgba(255, 255, 255, 0.5);
&:hover {
background: rgba(255, 255, 255, 0.8);
box-shadow:
0 12px 40px rgba(0, 0, 0, 0.12),
inset 0 1px 0 rgba(255, 255, 255, 0.6);
transform: translateY(-2px);
}
}
// Solid variant
&--solid {
background: white;
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
&:hover {
box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
transform: translateY(-2px);
}
}
// Gradient variant
&--gradient {
background: linear-gradient(135deg,
rgba(220, 38, 38, 0.05) 0%,
rgba(220, 38, 38, 0.02) 100%);
backdrop-filter: blur(20px);
border: 1px solid rgba(220, 38, 38, 0.1);
box-shadow: 0 8px 32px rgba(220, 38, 38, 0.08);
&:hover {
background: linear-gradient(135deg,
rgba(220, 38, 38, 0.08) 0%,
rgba(220, 38, 38, 0.03) 100%);
transform: translateY(-2px);
}
}
// Outline variant
&--outline {
background: transparent;
border: 2px solid rgba(220, 38, 38, 0.2);
&:hover {
background: rgba(220, 38, 38, 0.05);
border-color: rgba(220, 38, 38, 0.3);
transform: translateY(-2px);
}
}
&--clickable {
cursor: pointer;
}
&__header {
display: flex;
align-items: flex-start;
justify-content: space-between;
margin-bottom: 1rem;
}
&__icon-wrapper {
display: flex;
align-items: center;
justify-content: center;
width: 3rem;
height: 3rem;
background: linear-gradient(135deg,
rgba(220, 38, 38, 0.1) 0%,
rgba(220, 38, 38, 0.05) 100%);
border-radius: 12px;
}
&__icon {
width: 1.5rem;
height: 1.5rem;
color: #dc2626;
}
&__trend {
display: flex;
align-items: center;
gap: 0.25rem;
padding: 0.25rem 0.5rem;
border-radius: 8px;
font-size: 0.875rem;
font-weight: 600;
&--up {
color: #10b981;
background: rgba(16, 185, 129, 0.1);
}
&--down {
color: #ef4444;
background: rgba(239, 68, 68, 0.1);
}
&--neutral {
color: #6b7280;
background: rgba(107, 114, 128, 0.1);
}
}
&__trend-icon {
width: 1rem;
height: 1rem;
}
&__content {
margin-bottom: 1rem;
}
&__label {
font-size: 0.875rem;
font-weight: 500;
color: #6b7280;
margin: 0 0 0.5rem;
}
&__value-wrapper {
display: flex;
align-items: baseline;
gap: 0.25rem;
margin-bottom: 0.5rem;
}
&__value {
font-size: 2rem;
font-weight: 700;
color: #27272a;
line-height: 1;
}
&__prefix,
&__suffix {
font-size: 1.25rem;
font-weight: 500;
color: #6b7280;
}
&__description {
font-size: 0.875rem;
color: #6b7280;
margin: 0;
}
&__progress {
margin-top: 1rem;
}
&__progress-bar {
height: 6px;
background: rgba(220, 38, 38, 0.1);
border-radius: 3px;
overflow: hidden;
margin-bottom: 0.5rem;
}
&__progress-fill {
height: 100%;
background: linear-gradient(90deg, #dc2626 0%, #b91c1c 100%);
border-radius: 3px;
transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
}
&__progress-label {
font-size: 0.75rem;
color: #6b7280;
}
&__sparkline {
position: absolute;
bottom: 0;
left: 0;
right: 0;
height: 40px;
opacity: 0.5;
}
&__sparkline-svg {
width: 100%;
height: 100%;
color: #dc2626;
}
}
// Dark mode support
@media (prefers-color-scheme: dark) {
.stats-card {
&--glass {
background: rgba(30, 30, 30, 0.7);
border-color: rgba(255, 255, 255, 0.1);
}
&--solid {
background: #27272a;
}
&__value {
color: white;
}
&__label,
&__description,
&__progress-label {
color: #a3a3a3;
}
}
}
</style>

View File

@@ -0,0 +1,5 @@
<template>
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" d="M19 9l-7 7-7-7" />
</svg>
</template>