This session focused on applying the Atomic Design pattern across the core user flow pages of the IoTBay application. The goal was to replace hardcoded HTML elements with reusable JSP components (Atoms and Molecules) to ensure consistency and maintainability.
To support the complex requirements of existing pages (like JavaScript hooks and form validation), several core components were enhanced:
- Button Atom (
components/atoms/button/button.jsp)- Added
extraClassparameter to support utility classes. - Added
attributesparameter to support data attributes (e.g.,data-product-id). - Added
htmlTypeparameter to supportsubmitbuttons.
- Added
- Input Atom (
components/atoms/input/input.jsp)- Added
attributesparameter to supportpattern,oninput,onblur, etc.
- Added
- Form Field Molecule (
components/molecules/form-field/form-field.jsp)- Updated to pass
attributesdown to the Input atom.
- Updated to pass
- Quantity Controls: Replaced hardcoded
+and-buttons withbuttonatoms (Ghost variant). - Navigation: Replaced "Browse Products" and "Proceed to Checkout" links with
buttonatoms (Primary variant). - Result: Consistent button styling and behavior across the cart.
- Form Standardization: Replaced all manual
div.form-groupblocks with theform-fieldmolecule.- Applied to: Full Name, Email, Phone, Address, City, State, Zip Code.
- Preserved validation logic (patterns, onblur events) using the new
attributesparameter.
- Actions: Replaced the "Place Order" submit button with the
buttonatom, preserving the loading spinner and text.
- Status Indicators: Replaced manual badge spans with the
badgeatom (Success, Warning, Error variants). - Actions: Replaced "View Details", "Track Order", and "Reorder" buttons with
buttonatoms (Outline, Secondary, Ghost variants). - Empty State: Updated the "Start Shopping" button.
- Buy Box: Replaced Stock Status with
badgeatom and "Add to Cart" buttons withbuttonatom.
- Forms: Fully refactored to use
form-fieldmolecules.
- Product Grid: Refactored to use
product-cardmolecule.
The application now utilizes a consistent set of Atomic components for its primary interactive elements. This reduces code duplication and makes global style updates significantly easier. Future work can focus on refactoring the Admin Dashboard and User Profile pages.
Document Version: 1.0.0 Status: Published Last Updated: 12¿ù 3, 2025 Audience: Developers, Stakeholders Maintained By: IoT Bay Documentation Team