Added interactions to all the three cards#944
Added interactions to all the three cards#944withinJoel wants to merge 2 commits intoalphaonelabs:mainfrom
Conversation
WalkthroughAdded Tailwind CSS transition, hover, and focus-within classes to the three quiz category cards on the quiz list page so they animate with a 300ms upward translate and deeper shadow on hover/focus. No DOM, data, or functional changes. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related issues
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@web/templates/web/quiz/quiz_list.html`:
- Line 27: Update the card container divs in
web/templates/web/quiz/quiz_list.html that currently have the classes "bg-white
dark:bg-gray-800 rounded-lg shadow-lg overflow-hidden transition-all
duration-300 hover:-translate-y-1 hover:shadow-2xl" to also include the
corresponding focus-within variants so keyboard focus mirrors hover (e.g., add
"focus-within:-translate-y-1 focus-within:shadow-2xl"); apply the same change to
the other two card blocks mentioned (lines with the same div pattern).
- Line 27: The long Tailwind class strings on the three card containers (the
<div class="bg-white dark:bg-gray-800 rounded-lg shadow-lg overflow-hidden
transition-all duration-300 hover:-translate-y-1 hover:shadow-2xl"> instances at
the spots you changed) exceed the 120-char djlint limit; split the class
attribute across multiple lines (group utilities or put one or a few classes per
line) so each line stays ≤120 chars, apply the same split pattern to the other
two identical <div> elements, and then reformat the template with djlint
(120-char config) to ensure the file passes linting.
Updated transition classes for quiz card components to include focus states.
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@web/templates/web/quiz/quiz_list.html`:
- Around line 27-29: The card transform classes (hover:-translate-y-1 and
focus-within:-translate-y-1) are applied unconditionally; update the card
container class strings (the div with classes starting "bg-white
dark:bg-gray-800 rounded-lg shadow-lg overflow-hidden ...") to prefix those
transform utilities with Tailwind's motion-safe: so use
motion-safe:hover:-translate-y-1 and motion-safe:focus-within:-translate-y-1
(apply the same change to the other two card blocks with the identical class
pattern).
- Around line 27-29: The "My Quizzes" card's outer div (the element starting
with class "bg-white dark:bg-gray-800 rounded-lg shadow-lg overflow-hidden
transition...") is missing the h-full utility, causing inconsistent heights with
the other cards; update that div's class list to include "h-full" so it
stretches to match sibling cards (same fix applied for the card elements on
lines where Cards 2 and 3 already use h-full).
| <div class="bg-white dark:bg-gray-800 rounded-lg shadow-lg overflow-hidden | ||
| transition duration-300 hover:-translate-y-1 hover:shadow-2xl | ||
| focus-within:-translate-y-1 focus-within:shadow-2xl"> |
There was a problem hiding this comment.
Translate animation is not gated on prefers-reduced-motion.
The hover:-translate-y-1 and focus-within:-translate-y-1 transforms are applied unconditionally. Users who have enabled the OS-level "reduce motion" preference will still see the lift animation. Tailwind's motion-safe: prefix gates these transforms only when the user has not requested reduced motion, keeping the shadow-only effect as the fallback.
♻️ Proposed fix (same pattern for all three cards)
- transition duration-300 hover:-translate-y-1 hover:shadow-2xl
- focus-within:-translate-y-1 focus-within:shadow-2xl">
+ transition duration-300 motion-safe:hover:-translate-y-1 hover:shadow-2xl
+ motion-safe:focus-within:-translate-y-1 focus-within:shadow-2xl">Also applies to: 77-79, 120-122
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@web/templates/web/quiz/quiz_list.html` around lines 27 - 29, The card
transform classes (hover:-translate-y-1 and focus-within:-translate-y-1) are
applied unconditionally; update the card container class strings (the div with
classes starting "bg-white dark:bg-gray-800 rounded-lg shadow-lg overflow-hidden
...") to prefix those transform utilities with Tailwind's motion-safe: so use
motion-safe:hover:-translate-y-1 and motion-safe:focus-within:-translate-y-1
(apply the same change to the other two card blocks with the identical class
pattern).
Card 1 is missing h-full, causing potential height inconsistency with the other two cards.
Cards 2 (line 78) and 3 (line 121) both include h-full, but the My Quizzes card does not. In a CSS grid with align-items: stretch (the default), the inner card <div> needs h-full to fill the full row height when sibling cells are taller. Without it, this card may visually appear shorter when the other columns contain more quiz entries.
🐛 Proposed fix
- <div class="bg-white dark:bg-gray-800 rounded-lg shadow-lg overflow-hidden
- transition duration-300 hover:-translate-y-1 hover:shadow-2xl
- focus-within:-translate-y-1 focus-within:shadow-2xl">
+ <div class="bg-white dark:bg-gray-800 rounded-lg shadow-lg overflow-hidden
+ h-full transition duration-300 hover:-translate-y-1 hover:shadow-2xl
+ focus-within:-translate-y-1 focus-within:shadow-2xl">🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@web/templates/web/quiz/quiz_list.html` around lines 27 - 29, The "My Quizzes"
card's outer div (the element starting with class "bg-white dark:bg-gray-800
rounded-lg shadow-lg overflow-hidden transition...") is missing the h-full
utility, causing inconsistent heights with the other cards; update that div's
class list to include "h-full" so it stretches to match sibling cards (same fix
applied for the card elements on lines where Cards 2 and 3 already use h-full).
Related issues
Fixes #943
Checklist
Summary by CodeRabbit