A magazine that also sells
Capturing the tone of a fashion magazine without losing what a store needs: finding products, saving them and paying.
I build complete shopping flows: filters, a persistent cart and a validated checkout in vanilla JavaScript, with a magazine aesthetic.
Capturing the tone of a fashion magazine without losing what a store needs: finding products, saving them and paying.
Layered SCSS styles on top of the Bootstrap grid; filters, cart, checkout and payment written in vanilla JavaScript.
From collection to order confirmation, with the cart saved across pages and a demo payment that validates like a real one.
Filter by category, color and size, sort by price and search regardless of accents or capitalization. If nothing matches, a message says so and offers to clear the filters.
It's saved in localStorage, validates each product when reading it and keeps working even if storage is unavailable.
An order summary with free shipping from $300 USD, form validation, focus on the first error and an order number on confirmation.
The payment is a demo: card details are never stored or sent.
Even so, the form detects the brand (Visa, Mastercard or AMEX), formats the number as you type and validates it with the Luhn algorithm, the same one real cards use.
const BRANDS = [
{ label: "AMEX", pattern: /^3[47]/, length: 15 },
{ label: "VISA", pattern: /^4/, length: 16 },
{ label: "Mastercard", pattern: /^(5[1-5]|2[2-7])/, length: 16 },
];
// Luhn checksum: used by all real cards.
const passesLuhn = (digits) => {
let sum = 0;
digits.split("").reverse().forEach((char, index) => {
let digit = Number(char);
if (index % 2 === 1) {
digit *= 2;
if (digit > 9) digit -= 9;
}
sum += digit;
});
return sum % 10 === 0;
};