Skip to content

Commit 9eeb336

Browse files
committed
feat(ui): enhance card hover effects with trailing border animation and fix symbol alignment
- Add trailing border effect to agent and project cards with animated conic gradient - Fix rotating symbol vertical alignment from text-bottom to middle with position offset - Implement CSS custom properties for smooth border animation on hover - Maintain consistent styling across shimmer.css and styles.css files
1 parent 9b47779 commit 9eeb336

3 files changed

Lines changed: 64 additions & 4 deletions

File tree

src/App.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ function App() {
185185
transition={{ duration: 0.5, delay: 0.1 }}
186186
>
187187
<Card
188-
className="h-64 cursor-pointer transition-all duration-200 hover:scale-105 hover:shadow-lg border border-border/50 shimmer-hover"
188+
className="h-64 cursor-pointer transition-all duration-200 hover:scale-105 hover:shadow-lg border border-border/50 shimmer-hover trailing-border"
189189
onClick={() => handleViewChange("agents")}
190190
>
191191
<div className="h-full flex flex-col items-center justify-center p-8">
@@ -202,7 +202,7 @@ function App() {
202202
transition={{ duration: 0.5, delay: 0.2 }}
203203
>
204204
<Card
205-
className="h-64 cursor-pointer transition-all duration-200 hover:scale-105 hover:shadow-lg border border-border/50 shimmer-hover"
205+
className="h-64 cursor-pointer transition-all duration-200 hover:scale-105 hover:shadow-lg border border-border/50 shimmer-hover trailing-border"
206206
onClick={() => handleViewChange("projects")}
207207
>
208208
<div className="h-full flex flex-col items-center justify-center p-8">

src/assets/shimmer.css

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,10 @@
105105
font-size: 1.5rem; /* Make it bigger! */
106106
margin-right: 0.5rem;
107107
font-weight: bold;
108-
vertical-align: text-bottom;
108+
vertical-align: middle;
109109
position: relative;
110110
line-height: 1;
111+
top: -2px;
111112
}
112113

113114
.rotating-symbol::before {

src/styles.css

Lines changed: 60 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -442,11 +442,13 @@ button:focus-visible,
442442

443443
.rotating-symbol {
444444
display: inline-block;
445-
vertical-align: text-bottom;
445+
vertical-align: middle;
446446
line-height: 1;
447447
animation: fade-in 0.2s ease-out;
448448
font-weight: normal;
449449
font-size: 1.5rem; /* Make it bigger! */
450+
position: relative;
451+
top: -2px;
450452
}
451453

452454
.rotating-symbol::before {
@@ -497,6 +499,63 @@ button:focus-visible,
497499
animation: shimmer 0.5s;
498500
}
499501

502+
/* Trailing border effect */
503+
@property --angle {
504+
syntax: "<angle>";
505+
initial-value: 0deg;
506+
inherits: false;
507+
}
508+
509+
@keyframes trail-rotate {
510+
to {
511+
--angle: 360deg;
512+
}
513+
}
514+
515+
.trailing-border {
516+
position: relative;
517+
background: var(--color-card);
518+
z-index: 0;
519+
overflow: visible;
520+
}
521+
522+
/* The correctly traveling border line */
523+
.trailing-border::after {
524+
content: "";
525+
position: absolute;
526+
inset: -2px;
527+
padding: 2px;
528+
border-radius: inherit;
529+
background: conic-gradient(
530+
from var(--angle),
531+
transparent 0%,
532+
transparent 85%,
533+
#d97757 90%,
534+
#ff9a7a 92.5%,
535+
#d97757 95%,
536+
transparent 100%
537+
);
538+
-webkit-mask:
539+
linear-gradient(#fff 0 0) content-box,
540+
linear-gradient(#fff 0 0);
541+
-webkit-mask-composite: xor;
542+
mask-composite: exclude;
543+
opacity: 0;
544+
transition: opacity 0.3s ease;
545+
z-index: -1;
546+
}
547+
548+
.trailing-border:hover::after {
549+
opacity: 1;
550+
animation: trail-rotate 2s linear infinite;
551+
}
552+
553+
/* Ensure the card content stays above the border effect */
554+
.trailing-border > * {
555+
position: relative;
556+
z-index: 1;
557+
}
558+
500559
/* --- THEME-MATCHING SCROLLBARS --- */
501560

502561
/* For Firefox */

0 commit comments

Comments
 (0)