Skip to content
Submitted about 17 hours ago

Frontend quiz app with Sass, TypeScript, native radios and dark mode

sass/scss, typescript
P
LVL 3
Darkmift•359
@Avi-E-Koenig
A solution to the Frontend Quiz app challenge

Solution retrospective


What are you most proud of, and what would you do differently next time?

I'm happy with how the logic is split. quiz.ts is pure functions: startQuiz, submitAnswer and nextQuestion take a state and return a new one, with a phase of answering, answered or complete, so one form submit either checks the answer or moves on. It has 8 node:test tests, run in CI before deploy. The answers are native radio buttons styled with :has(), so arrow keys, Space and Enter work without extra code. Focus moves to each new screen's heading, and a hidden status line announces whether an answer was right. The dark theme uses CSS custom properties and follows the system setting until the switch is used, with no flash on load.

What challenges did you encounter, and how did you overcome them?

On desktop the question screen's gap: 32px reset the 128px column gap from the shared layout, so the answers sat right next to the question until I compared it with the Figma frame. The answers, button and error share a wrapper with display: contents on desktop, and a .screen > * selector didn't match its children, so the button landed in the wrong column. Long answers also wrapped too early, because the empty slot for the result icon took space on every card.

Several answers in data.json are markup themselves (<a>, <html>), so everything goes in with textContent.

I built this together with Claude Code as a pair programmer. I chose Sass, TypeScript and the dark theme, with matching the design as the priority. Claude made the calls the design leaves open (listed in the README), read the values from Figma, drafted the code and tests, and ran the layout and keyboard checks in Chromium, Firefox and WebKit.

What specific areas of your project would you like help with?
  1. Locked answers: after submitting, the radio buttons are disabled and focus moves to the Next button. Does that feel right with a screen reader, or would you keep them enabled and just ignore changes?
  2. Colour contrast: I kept the design's colours, including white letters on the green chip (1.86:1) and red error text at 18px on mobile (3.22:1); the README lists them all. Would you change any of them, even if it moves away from the design?
Code
Loading...

Please log in to post a comment

Log in

Community feedback

No feedback yet. Be the first to give feedback on Darkmift’s solution.

Join our Discord community

Join thousands of Frontend Mentor community members taking the challenges, sharing resources, helping each other, and chatting about all things front-end!

Join our Discord