feat(web): adopt vuesax icons and shared skeleton loading
Replace the inline SVG icon set with the vuesax linear pack, add skeleton primitives for loading states, and keep page scroll inside the app shell. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -185,6 +185,13 @@ const fabStyle = computed(() => ({
|
||||
bottom: 'auto',
|
||||
}));
|
||||
|
||||
const panelPlacement = computed(() => {
|
||||
const edge = 16;
|
||||
const spaceAbove = fabPos.value.top - edge;
|
||||
const spaceBelow = viewport.value.h - (fabPos.value.top + FAB_SIZE) - edge;
|
||||
return spaceAbove >= spaceBelow ? 'above' : 'below';
|
||||
});
|
||||
|
||||
const panelStyle = computed(() => {
|
||||
const gap = 12;
|
||||
const edge = 16;
|
||||
@@ -193,28 +200,33 @@ const panelStyle = computed(() => {
|
||||
left = Math.min(left, viewport.value.w - width - edge);
|
||||
left = Math.max(edge, left);
|
||||
|
||||
const spaceAbove = fabPos.value.top - edge;
|
||||
const spaceBelow = viewport.value.h - (fabPos.value.top + FAB_SIZE) - edge;
|
||||
const placeAbove = spaceAbove >= spaceBelow;
|
||||
const maxHeight = Math.max(0, (placeAbove ? spaceAbove : spaceBelow) - gap);
|
||||
const placeAbove = panelPlacement.value === 'above';
|
||||
const maxHeight = Math.max(
|
||||
0,
|
||||
(placeAbove
|
||||
? fabPos.value.top - edge
|
||||
: viewport.value.h - (fabPos.value.top + FAB_SIZE) - edge) - gap,
|
||||
);
|
||||
|
||||
const shared = {
|
||||
left: `${left}px`,
|
||||
right: 'auto',
|
||||
width: `${width}px`,
|
||||
maxHeight: `${maxHeight}px`,
|
||||
transformOrigin: placeAbove ? 'bottom left' : 'top left',
|
||||
};
|
||||
|
||||
if (placeAbove) {
|
||||
return {
|
||||
left: `${left}px`,
|
||||
right: 'auto',
|
||||
...shared,
|
||||
bottom: `${viewport.value.h - fabPos.value.top + gap}px`,
|
||||
top: 'auto',
|
||||
width: `${width}px`,
|
||||
maxHeight: `${maxHeight}px`,
|
||||
};
|
||||
}
|
||||
return {
|
||||
left: `${left}px`,
|
||||
right: 'auto',
|
||||
...shared,
|
||||
top: `${fabPos.value.top + FAB_SIZE + gap}px`,
|
||||
bottom: 'auto',
|
||||
width: `${width}px`,
|
||||
maxHeight: `${maxHeight}px`,
|
||||
};
|
||||
});
|
||||
|
||||
@@ -238,10 +250,6 @@ function onKeydown(ev: KeyboardEvent) {
|
||||
}
|
||||
}
|
||||
|
||||
watch(isQuickCreateOpen, (value) => {
|
||||
document.body.style.overflow = value ? 'hidden' : '';
|
||||
});
|
||||
|
||||
watch(hidden, (value) => {
|
||||
if (value) close();
|
||||
});
|
||||
@@ -264,46 +272,51 @@ onMounted(() => {
|
||||
onBeforeUnmount(() => {
|
||||
window.removeEventListener('resize', onResize);
|
||||
window.removeEventListener('keydown', onKeydown);
|
||||
document.body.style.overflow = '';
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Teleport to="body">
|
||||
<div v-if="!hidden" class="qc" dir="rtl">
|
||||
<button
|
||||
v-if="isQuickCreateOpen"
|
||||
class="overlay"
|
||||
type="button"
|
||||
aria-label="بستن ایجاد سریع"
|
||||
@click="close"
|
||||
/>
|
||||
<Transition name="qc-overlay">
|
||||
<button
|
||||
v-if="isQuickCreateOpen"
|
||||
class="overlay"
|
||||
type="button"
|
||||
aria-label="بستن ایجاد سریع"
|
||||
@click="close"
|
||||
/>
|
||||
</Transition>
|
||||
|
||||
<section
|
||||
v-if="isQuickCreateOpen"
|
||||
class="panel"
|
||||
aria-labelledby="qc-title"
|
||||
:style="panelStyle"
|
||||
>
|
||||
<h2 id="qc-title">ایجاد سریع</h2>
|
||||
<div class="items">
|
||||
<button
|
||||
v-for="item in items"
|
||||
:key="item.key"
|
||||
class="item"
|
||||
type="button"
|
||||
@click="go(item.to)"
|
||||
>
|
||||
<span class="item-ico" :class="item.tone">
|
||||
<UiIcon :name="item.icon" :size="18" />
|
||||
</span>
|
||||
<span class="copy">
|
||||
<strong>{{ item.title }}</strong>
|
||||
<small>{{ item.desc }}</small>
|
||||
</span>
|
||||
</button>
|
||||
</div>
|
||||
</section>
|
||||
<Transition name="qc-panel">
|
||||
<section
|
||||
v-if="isQuickCreateOpen"
|
||||
class="panel"
|
||||
:data-place="panelPlacement"
|
||||
aria-labelledby="qc-title"
|
||||
:style="panelStyle"
|
||||
>
|
||||
<h2 id="qc-title">ایجاد سریع</h2>
|
||||
<div class="items">
|
||||
<button
|
||||
v-for="(item, index) in items"
|
||||
:key="item.key"
|
||||
class="item"
|
||||
type="button"
|
||||
:style="{ '--qc-i': index }"
|
||||
@click="go(item.to)"
|
||||
>
|
||||
<span class="item-ico" :class="item.tone">
|
||||
<UiIcon :name="item.icon" :size="18" />
|
||||
</span>
|
||||
<span class="copy">
|
||||
<strong>{{ item.title }}</strong>
|
||||
<small>{{ item.desc }}</small>
|
||||
</span>
|
||||
</button>
|
||||
</div>
|
||||
</section>
|
||||
</Transition>
|
||||
|
||||
<button
|
||||
v-if="ready"
|
||||
@@ -319,6 +332,8 @@ onBeforeUnmount(() => {
|
||||
@pointerup="onFabPointerUp"
|
||||
@pointercancel="onFabPointerUp"
|
||||
>
|
||||
<span class="fab-pulse" aria-hidden="true" />
|
||||
<span class="fab-shine" aria-hidden="true" />
|
||||
<span class="fab-face" aria-hidden="true">
|
||||
<UiIcon :name="isQuickCreateOpen ? 'x' : 'apps-plus'" :size="20" />
|
||||
</span>
|
||||
@@ -338,11 +353,12 @@ onBeforeUnmount(() => {
|
||||
z-index: 90;
|
||||
border: 0;
|
||||
padding: 0;
|
||||
background: rgba(0, 0, 0, 0.68);
|
||||
background: rgba(15, 23, 42, 0.42);
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.panel {
|
||||
--qc-ease: cubic-bezier(0.22, 1, 0.36, 1);
|
||||
position: fixed;
|
||||
z-index: 92;
|
||||
width: 300px;
|
||||
@@ -352,10 +368,90 @@ onBeforeUnmount(() => {
|
||||
flex-direction: column;
|
||||
background: #fff;
|
||||
border: 1px solid var(--line);
|
||||
border-radius: var(--radius);
|
||||
border-radius: 14px;
|
||||
padding: 12px 12px 10px;
|
||||
box-shadow: var(--shadow-lg);
|
||||
box-shadow:
|
||||
0 18px 40px -18px rgba(15, 23, 42, 0.35),
|
||||
0 8px 18px -10px rgba(13, 148, 136, 0.18),
|
||||
0 0 0 1px rgba(255, 255, 255, 0.65) inset;
|
||||
overflow: hidden;
|
||||
will-change: transform, opacity;
|
||||
}
|
||||
|
||||
.qc-overlay-enter-active,
|
||||
.qc-overlay-leave-active {
|
||||
transition: opacity 0.16s ease;
|
||||
}
|
||||
|
||||
.qc-overlay-enter-from,
|
||||
.qc-overlay-leave-to {
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
.qc-panel-enter-active {
|
||||
transition:
|
||||
opacity 0.18s var(--qc-ease),
|
||||
transform 0.2s var(--qc-ease);
|
||||
}
|
||||
|
||||
.qc-panel-leave-active {
|
||||
transition:
|
||||
opacity 0.14s ease,
|
||||
transform 0.16s ease;
|
||||
}
|
||||
|
||||
.qc-panel-enter-from {
|
||||
opacity: 0;
|
||||
transform: translateY(8px) scale(0.97);
|
||||
}
|
||||
|
||||
.panel[data-place='above'].qc-panel-enter-from {
|
||||
transform: translateY(-8px) scale(0.97);
|
||||
}
|
||||
|
||||
.qc-panel-leave-to {
|
||||
opacity: 0;
|
||||
transform: translateY(4px) scale(0.98);
|
||||
}
|
||||
|
||||
.panel[data-place='above'].qc-panel-leave-to {
|
||||
transform: translateY(-4px) scale(0.98);
|
||||
}
|
||||
|
||||
.qc-panel-enter-active .items {
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.qc-panel-enter-active .item {
|
||||
animation: qc-item-in 0.2s var(--qc-ease) both;
|
||||
animation-delay: calc(0.02s + var(--qc-i, 0) * 0.02s);
|
||||
}
|
||||
|
||||
.qc-panel-enter-active h2 {
|
||||
animation: qc-item-in 0.16s var(--qc-ease) both;
|
||||
}
|
||||
|
||||
@keyframes qc-item-in {
|
||||
from {
|
||||
opacity: 0;
|
||||
transform: translateY(6px);
|
||||
}
|
||||
to {
|
||||
opacity: 1;
|
||||
transform: translateY(0);
|
||||
}
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.qc-overlay-enter-active,
|
||||
.qc-overlay-leave-active,
|
||||
.qc-panel-enter-active,
|
||||
.qc-panel-leave-active,
|
||||
.qc-panel-enter-active .item,
|
||||
.qc-panel-enter-active h2 {
|
||||
transition: none !important;
|
||||
animation: none !important;
|
||||
}
|
||||
}
|
||||
|
||||
.panel h2 {
|
||||
@@ -369,12 +465,20 @@ onBeforeUnmount(() => {
|
||||
|
||||
.items {
|
||||
min-height: 0;
|
||||
overflow-x: hidden;
|
||||
overflow-y: auto;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 6px;
|
||||
padding-left: 2px;
|
||||
overscroll-behavior: contain;
|
||||
scrollbar-width: none;
|
||||
}
|
||||
|
||||
.items::-webkit-scrollbar {
|
||||
display: none;
|
||||
width: 0;
|
||||
height: 0;
|
||||
}
|
||||
|
||||
.item {
|
||||
@@ -450,6 +554,7 @@ onBeforeUnmount(() => {
|
||||
}
|
||||
|
||||
.fab {
|
||||
--fab-ease: cubic-bezier(0.22, 1, 0.36, 1);
|
||||
position: fixed;
|
||||
z-index: 93;
|
||||
box-sizing: border-box;
|
||||
@@ -459,57 +564,226 @@ onBeforeUnmount(() => {
|
||||
margin: 0;
|
||||
border: 0;
|
||||
border-radius: var(--radius);
|
||||
overflow: hidden;
|
||||
background: linear-gradient(145deg, #0f766e 0%, #14b8a6 100%);
|
||||
overflow: visible;
|
||||
background: linear-gradient(145deg, #0f766e 0%, #14b8a6 55%, #2dd4bf 100%);
|
||||
background-size: 140% 140%;
|
||||
color: #fff;
|
||||
display: grid;
|
||||
place-items: center;
|
||||
line-height: 0;
|
||||
direction: ltr;
|
||||
isolation: isolate;
|
||||
box-shadow:
|
||||
0 4px 14px rgba(13, 148, 136, 0.35),
|
||||
inset 0 1px 0 rgba(255, 255, 255, 0.22);
|
||||
0 0 0 0 rgba(45, 212, 191, 0.28),
|
||||
inset 0 1px 0 rgba(255, 255, 255, 0.28);
|
||||
cursor: grab;
|
||||
touch-action: none;
|
||||
user-select: none;
|
||||
transition:
|
||||
filter 0.15s ease,
|
||||
box-shadow 0.15s ease,
|
||||
transform 0.12s ease;
|
||||
filter 0.35s var(--fab-ease),
|
||||
box-shadow 0.35s var(--fab-ease),
|
||||
transform 0.35s var(--fab-ease),
|
||||
background 0.4s var(--fab-ease);
|
||||
animation:
|
||||
fab-glow 3.4s ease-in-out infinite,
|
||||
fab-gradient 7s ease-in-out infinite;
|
||||
}
|
||||
|
||||
.fab-pulse,
|
||||
.fab-shine,
|
||||
.fab-face {
|
||||
grid-area: 1 / 1;
|
||||
}
|
||||
|
||||
.fab-pulse {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
border-radius: inherit;
|
||||
pointer-events: none;
|
||||
z-index: 0;
|
||||
box-shadow: 0 0 0 0 rgba(45, 212, 191, 0.42);
|
||||
animation: fab-ring 2.8s var(--fab-ease) infinite;
|
||||
}
|
||||
|
||||
.fab-shine {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
border-radius: inherit;
|
||||
overflow: hidden;
|
||||
pointer-events: none;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.fab-shine::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: -20%;
|
||||
bottom: -20%;
|
||||
left: -40%;
|
||||
width: 42%;
|
||||
background: linear-gradient(
|
||||
105deg,
|
||||
transparent 0%,
|
||||
rgba(255, 255, 255, 0.08) 35%,
|
||||
rgba(255, 255, 255, 0.42) 50%,
|
||||
rgba(255, 255, 255, 0.08) 65%,
|
||||
transparent 100%
|
||||
);
|
||||
transform: translateX(-160%) skewX(-18deg);
|
||||
animation: fab-sheen 4.8s var(--fab-ease) infinite;
|
||||
}
|
||||
|
||||
.fab-face {
|
||||
position: relative;
|
||||
z-index: 2;
|
||||
display: grid;
|
||||
place-items: center;
|
||||
place-content: center;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
pointer-events: none;
|
||||
transition: transform 0.45s var(--fab-ease);
|
||||
animation: fab-breathe 3.4s ease-in-out infinite;
|
||||
}
|
||||
|
||||
.fab :deep(.ico) {
|
||||
.fab :deep(.ico),
|
||||
.fab :deep(svg) {
|
||||
display: block;
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
max-width: 20px;
|
||||
max-height: 20px;
|
||||
margin: 0;
|
||||
stroke-width: 1.7;
|
||||
filter: drop-shadow(0 1px 1px rgba(15, 23, 42, 0.18));
|
||||
transition: transform 0.45s var(--fab-ease), opacity 0.25s ease;
|
||||
}
|
||||
|
||||
.fab:hover {
|
||||
filter: brightness(1.06);
|
||||
filter: brightness(1.07) saturate(1.05);
|
||||
transform: translateY(-1px) scale(1.04);
|
||||
box-shadow:
|
||||
0 6px 18px rgba(13, 148, 136, 0.42),
|
||||
inset 0 1px 0 rgba(255, 255, 255, 0.25);
|
||||
0 10px 24px rgba(13, 148, 136, 0.42),
|
||||
0 0 0 5px rgba(45, 212, 191, 0.12),
|
||||
inset 0 1px 0 rgba(255, 255, 255, 0.32);
|
||||
}
|
||||
|
||||
.fab:hover .fab-face {
|
||||
animation-play-state: paused;
|
||||
transform: scale(1.06);
|
||||
}
|
||||
|
||||
.fab.open {
|
||||
background: linear-gradient(145deg, #115e59 0%, #0d9488 100%);
|
||||
box-shadow: 0 6px 20px rgba(15, 23, 42, 0.25);
|
||||
box-shadow:
|
||||
0 8px 22px rgba(15, 23, 42, 0.28),
|
||||
inset 0 1px 0 rgba(255, 255, 255, 0.18);
|
||||
animation: none;
|
||||
}
|
||||
|
||||
.fab.open .fab-pulse,
|
||||
.fab.open .fab-shine::after {
|
||||
animation: none;
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
.fab.open .fab-face {
|
||||
animation: none;
|
||||
transform: rotate(90deg) scale(1.02);
|
||||
}
|
||||
|
||||
.fab.dragging {
|
||||
cursor: grabbing;
|
||||
transform: scale(1.05);
|
||||
box-shadow: 0 8px 24px rgba(13, 148, 136, 0.45);
|
||||
transform: scale(1.08);
|
||||
box-shadow:
|
||||
0 12px 28px rgba(13, 148, 136, 0.48),
|
||||
0 0 0 6px rgba(45, 212, 191, 0.14),
|
||||
inset 0 1px 0 rgba(255, 255, 255, 0.3);
|
||||
animation: none;
|
||||
transition-duration: 0.12s;
|
||||
}
|
||||
|
||||
.fab.dragging .fab-pulse,
|
||||
.fab.dragging .fab-shine::after,
|
||||
.fab.dragging .fab-face {
|
||||
animation: none;
|
||||
}
|
||||
|
||||
@keyframes fab-glow {
|
||||
0%,
|
||||
100% {
|
||||
box-shadow:
|
||||
0 4px 14px rgba(13, 148, 136, 0.32),
|
||||
0 0 0 0 rgba(45, 212, 191, 0.22),
|
||||
inset 0 1px 0 rgba(255, 255, 255, 0.24);
|
||||
}
|
||||
50% {
|
||||
box-shadow:
|
||||
0 8px 22px rgba(13, 148, 136, 0.48),
|
||||
0 0 18px 2px rgba(45, 212, 191, 0.2),
|
||||
inset 0 1px 0 rgba(255, 255, 255, 0.34);
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes fab-gradient {
|
||||
0%,
|
||||
100% {
|
||||
background-position: 0% 40%;
|
||||
}
|
||||
50% {
|
||||
background-position: 100% 60%;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes fab-ring {
|
||||
0% {
|
||||
box-shadow: 0 0 0 0 rgba(45, 212, 191, 0.4);
|
||||
opacity: 1;
|
||||
}
|
||||
70% {
|
||||
box-shadow: 0 0 0 12px rgba(45, 212, 191, 0);
|
||||
opacity: 0;
|
||||
}
|
||||
100% {
|
||||
opacity: 0;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes fab-sheen {
|
||||
0%,
|
||||
55% {
|
||||
transform: translateX(-160%) skewX(-18deg);
|
||||
}
|
||||
85%,
|
||||
100% {
|
||||
transform: translateX(320%) skewX(-18deg);
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes fab-breathe {
|
||||
0%,
|
||||
100% {
|
||||
transform: scale(1);
|
||||
}
|
||||
50% {
|
||||
transform: scale(1.05);
|
||||
}
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.fab,
|
||||
.fab-pulse,
|
||||
.fab-shine::after,
|
||||
.fab-face {
|
||||
animation: none !important;
|
||||
}
|
||||
|
||||
.fab:hover,
|
||||
.fab.open .fab-face {
|
||||
transform: none;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user