Welcome to Week 1, Day 4 of my Weekly UI challenge! As I stated in the announcement post, week 1 will focus on an ecommerce listing UI component; each day throughout this following week, I will pick one or two (usually related) subelements of the design to implement. For day four, our goal is to…
Sometimes when you are a business owner, you have to generate interest for your items or incentivize customers to purchase a product. With a brick-and-mortar store, perhaps that's a flashy sign or a kitschy local TV ad; with an online store, that could be a banner across the top of the listing, a ribbon decorating an upper corner of a product card, or a SALE callout on the listing, which is what I have configured.
Conversely, it's nice to tell your customers– before they click through to the product page– whether an item is still in stock or not. To aid my users in their search for products they can actually buy, I've added a SOLD OUT callout in place of a price.
Following the original design I created, this is what I've got for Day 4:
For the sale price display, I added a green callout, or "badge" as it's referred to sometimes. I then render the sale price next to it, naturally; to cap off the sale update, I strike-through the original price, so users can see their savings! (we're talking about literally slashing prices here)
For the sold out display, I actually use the same badge component with different props to make the border/text color red. No need to display the price for this product, since it is not available for sale; if this was hooked up to a larger ecommerce platform, you could/should still link the component through to the product page, and display the price there, for inquisitive minds and long-term planners.
Finally, in order to make sure the ecommerce database team doesn't need to go in and scrub some orders and issue apology emails, I need to disable the button and its function. Since this is a semantic
button element, I can add the
disabled attribute (or since I'm using React, a "prop") to render the button unclickable; to be safe, I also remove the
onClick handler as well, and make the button grayscale for visual shoppers.
You can check out my coded implementation on my Github pages site for this project.
I used React.js and Storybook to develop my implementation, but you can use whatever technology stack you would like! (hint: if you use Vue.js or Angular.js, you can still use Storybook for those libraries)
Also, please add your repos and/or images of your designs in the comments for inspiration! I would love to see what designs you all create.
Happy coding! 🎉
- Design component ✅
- Display product name, price, and image ✅
- Add to cart button, favorite button ✅
- Sale price display, sold out states 🎯
- Color variant thumbnail buttons
- 100% a11y score
- Tweaks, refactors, fixes