1
0
Fork 0

feat(journals): animate the XP hint

This commit is contained in:
Jason Fraley 2026-10-13 15:23:31 -04:00
parent 88d674cff6
commit 076de5d60c
2 changed files with 49 additions and 2 deletions

View file

@ -312,6 +312,51 @@
}
}
/* Journal "this will earn XP" hint: the sparkles pop in, then the copy wipes in
from the left half a beat later. The motion is skipped when the user asks for
reduced motion; the hint itself still shows, just without animating. */
@keyframes journal-xp-icon-in {
from {
opacity: 0;
transform: scale(0.7);
}
to {
opacity: 1;
transform: scale(1);
}
}
@keyframes journal-xp-text-in {
from {
opacity: 0;
clip-path: inset(0 100% 0 0);
}
60% {
opacity: 1;
}
to {
opacity: 1;
clip-path: inset(0 0 0 0);
}
}
.journal-xp-hint-icon {
animation: journal-xp-icon-in 0.35s ease-out both;
}
.journal-xp-hint-text {
animation: journal-xp-text-in 0.45s ease-out 0.5s both;
}
@media (prefers-reduced-motion: reduce) {
.journal-xp-hint-icon,
.journal-xp-hint-text {
animation: none;
opacity: 1;
clip-path: none;
}
}
.locker-search-highlight {
animation: locker-search-pulse 1.1s ease-in-out infinite;
box-shadow: 0 0 0 3px rgb(251 191 36 / 0.9);

View file

@ -252,8 +252,10 @@ export function JournalFormDialog({
/>
{bodyLength >= JOURNAL_XP_MIN_CHARS && (
<p className="flex items-center gap-1.5 text-xs text-amber-400">
<SparklesIcon className="size-3.5 shrink-0" />
{`Nice - you'll earn ${JOURNAL_XP_POINTS} XP from this journal entry!`}
<SparklesIcon className="journal-xp-hint-icon size-3.5 shrink-0" />
<span className="journal-xp-hint-text">
{`Nice - you'll earn ${JOURNAL_XP_POINTS} XP from this journal entry!`}
</span>
</p>
)}
</div>