Newsletter-sign-up-form-with-success-message

Solution retrospective
I'm quite proud of successfully implementing the different states of the newsletter form: the default view, the error state with specific messages, and the success message display. Getting the responsive design to work smoothly, transitioning from the two-column desktop layout to the mobile view (with the illustration on top), was also a key achievement for me. I paid attention to details like the hover states on the button and the layout of the list items. Next time, I might spend a bit more time upfront planning the CSS structure, perhaps considering a methodology like BEM more strictly from the outset, even for a smaller component like this. I also think I could explore more efficient ways to handle the DOM manipulation for switching between the form and success views, perhaps by creating reusable functions if the component were more complex. I'd also consider how to better integrate a more complex SVG illustration if the design demanded it, ensuring it scales and positions correctly.
What challenges did you encounter, and how did you overcome them?One of the main challenges was the responsive layout switch, particularly ensuring the illustration part behaved correctly (e.g., changing from a side panel to a top banner with appropriate border-radius adjustments). This required careful use of Flexbox and media queries. I initially had some issues with the illustration's dimensions and border-radius on mobile, which I resolved by adjusting its flex properties, setting a fixed height for mobile, and ensuring the border-radius was applied correctly to the new top-banner orientation. Another challenge was ensuring the error messages displayed correctly next to the label without disrupting the layout too much. I used a flex container for the label and error message to keep them aligned. The JavaScript for validation and toggling error states needed careful thought to ensure it was clear and didn't lead to repetitive code. I overcame this by breaking down the validation logic and using clear class toggles.
What specific areas of your project would you like help with?I'd appreciate any feedback on the following: JavaScript Efficiency & Structure: Is the JavaScript for handling form submission, validation, and state toggling (form vs. success message) clean and efficient? Are there more modern or robust patterns I could have used? CSS Best Practices for Responsiveness: While the layout works, are there any more elegant or standard ways to handle the desktop-to-mobile transition for this type of component? Any tips on managing the illustration's aspect ratio or display more effectively across views? Accessibility: I tried to use semantic HTML and appropriate labels. Are there any further accessibility improvements I could make to the form or the success message? For instance, regarding focus management after submission or when an error appears. HTML Semantics: Is the HTML structure as semantic as it could be for this component? Any general feedback on code organization or potential improvements would be greatly appreciated!
Please log in to post a comment
Log in with GitHubCommunity feedback
No feedback yet. Be the first to give feedback on Jaya Sharma'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