Design comparison
Solution retrospective
I’m proud of becoming more familiar with React, learning the basics of Formik, and using CSS variables effectively. I’m also pleased with having met some of the WCAG accessibility guidelines.
What challenges did you encounter, and how did you overcome them?The most challenging part was figuring out how to position the logo whether to use a conditional render or the approach I ended up using. Since the component was already created, I chose to use Tailwind Merge to change classes rather than repeating myself.
Another challenge was effectively using CSS variables with Tailwind, especially with gradients.
What specific areas of your project would you like help with?I would appreciate feedback on:
- Whether the code is semantically correct.
- If there’s a better way to use CSS variables.
Community feedback
- @rupali317Posted 3 months ago
Hi @Smailen5
Based on your question "whether the code is semantically correct", I would like to suggest the following:
- Your code is missing a <h1> tag. Having 1 h1 tag is crucial for assistive technologies to understand how the page is structured. In your case, instead of h2 you should use the h1 tag and style it accordingly.
- You have used <section> tag to enclose the header and the content. The logo can be enclosed in a <header> tag instead of a generic <section> tag. The content can be wrapped in a <main>. <main> and <header> are examples of HTML landmarks. These tags are more semantic than a <section>.
- You can consider using <input> tag's pattern attribute to handle the regex check. It is better to put the responsibility to the CSS since doing the regex code on CSS will mean less code on the Javascript side. There will be performance improvement. Browsers are optimized to handle CSS operations more efficiently than JavaScript.
Let me know if the above suggestions help!
Marked as helpful0@Smailen5Posted 3 months agoHi @rupali317,
Thank you for the advice, it was very helpful.
However, I don't quite agree with the last point. Since I'm using Formik and Yup, I'm already implementing a robust form validation. I initially considered using Tailwind for this purpose, but given that I'm working with Formik, I found it more beneficial to rely on Yup, especially because it prevents the form from being submitted if the validation fails.
I’ve added a special acknowledgment for you in the README file of my project to express my gratitude for your assistance.
Thanks again for your support!
1@rupali317Posted 3 months ago@Smailen5 I appreciate the acknowledgment!
Thanks for sharing your insight on Formik and Yup. You initially considered Tailwind to achieve the same purpose. I am curious about the performance between relying on Tailwind vs Yup.
If you were to implement the project using only HTML, CSS and Javascript, which method would you use?
0
Please log in to post a comment
Log in with GitHubJoin 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