Interactive Pricing Components using NextJS and Typescript

Solution retrospective
I'm happy with how the pricing page's background turned out - the subtle grid pattern and soft glow effects add depth without getting in the way of the pricing information. Looking at the code in PricingComponent.tsx, you can see this in the SimpleAnimatedBackground component that uses basic opacity and masking.
If I did this project again, I would:
- Make the theme colours easier to change - right now they're all individual variables in
globals.css - Create separate components for animations instead of putting them all in
SimpleAnimatedBackground - Use CSS custom properties for animations instead of only Tailwind classes
- Make the slider work better with keyboards and screen readers (the current
CustomSliderneeds work)
The main problem was making sure the animated background didn't interfere with using the pricing slider and buttons. After some trial and error, I:
- Used
z-indexin the code to put the background behind everything else - Added
pointer-events-noneto the background div so clicks would go through to the elements underneath - Turned down the opacity and added blur effects to make the background subtle
- Made sure everything still looked good on phones and tablets
Another tricky part was getting the light and dark themes to work properly. Looking at globals.css, you can see I had to carefully pick colours that would work in both modes.
The pricing slider also took some work to get right. I had to make sure it updated the prices smoothly and looked consistent with the rest of the design.
What specific areas of your project would you like help with? Accessibility- Better keyboard support for the slider (right now it's just mouse/touch)
- Making sure the color contrast is good enough
- Adding proper screen reader labels
- Reducing the amount of CSS
- Making the animations smoother
- Finding better ways to load the code
- Whether to keep using local state (
useState) or switch to something else - How to organize the code if we add user accounts or more pricing plans
- Setting up testing tools
- Writing tests for the pricing calculations
- Testing that the theme switcher and slider work correctly
Looking at PricingComponent.tsx, there's no testing set up yet, and the accessibility features are pretty basic. These would be the most important areas to improve.
Please log in to post a comment
Log in with GitHubCommunity feedback
No feedback yet. Be the first to give feedback on Shreyansh Shukla’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