A mobile-first restaurant ordering app built with vanilla JavaScript. Users can browse the menu, add and remove items, see the total price, and complete the order through a payment form with validation.
- Menu rendered dynamically from a data file
- Add items to the order and remove them individually
- Total price calculated automatically
- Order section appears and hides depending on its contents
- Payment modal with required fields and format validation
- Personalized confirmation message after payment
- Keyboard accessible: visible focus styles, labelled buttons, screen-reader announcements
- Lighthouse: Accessibility 100, Best Practices 100, SEO 100
- Meal deal: pizza + beer in one order gives 15% off the pair
- Light and dark theme toggle built on CSS custom properties
- Rate your experience: accessible 5-star rating built on native radio buttons
- HTML5 (semantic markup)
- CSS3: Flexbox, BEM, custom properties, media queries
- JavaScript (ES6 modules)
- Vite
- Netlify (deploy)
- Used event delegation with
closest()and data attributes to handle clicks on dynamically rendered buttons with a single listener. - Learned that
datasetvalues are always strings, since HTML attributes are plain text, and converted them withNumber()before comparing with numeric IDs. - Practiced array methods in a real context:
map()to render HTML,find()to look up menu items by ID,splice()to remove a single order item by index, andreduce()to calculate the total. - Kept the order array as the single source of truth: every action updates the data first, then re-renders the order list, total, and visibility from it.
- Used
classList.toggle()with a condition to show or hide the order section based on the data, and learned when it doesn’t fit: the confirmation message depends on an event (payment), not on the data, so it needs explicitadd/remove. - Handled the payment form with the
submitevent instead of a button click, so built-in validation (required,pattern) runs first; usedpreventDefault()to stop the page reload andFormDatato read the customer’s name. - Made the app keyboard and screen-reader friendly: descriptive
aria-labelson icon buttons, visible:focus-visiblestyles, visually hidden form labels, arole="status"confirmation message, and moving focus into the payment modal when it opens. - Moved the meal deal rules (item IDs and discount percent) into the data file, so the promo can change without touching the logic; used
some()to check the order and an earlyreturnto keep the function flat. - Formatted all prices through a single
formatPrice()helper withtoFixed(2). - Built a theme toggle where JS only switches a
data-themeattribute on<html>; CSS custom properties and attribute selectors handle all colors and the icon, andaria-pressedtells screen readers the current state. - Built the star rating on radio inputs inside a
fieldset, so keyboard and screen-reader support come for free; used:checked, the+and~combinators and:has()to highlight stars with CSS only.
git clone https://github.com/Yurdoy/restaurant-ordering-app.git
cd restaurant-ordering-app
npm install
npm run devDesign and project brief by Scrimba as part of the Full Stack Developer Course.

