This is a solution to the E-commerce product page challenge on Frontend Mentor. Frontend Mentor challenges help you improve your coding skills by building realistic projects.
Users should be able to:
- View the optimal layout for the site depending on their device's screen size
- See hover states for all interactive elements on the page
- Open a lightbox gallery by clicking on the large product image
- Switch the large product image by clicking on the small thumbnail images
- Add items to the cart
- View the cart and remove items from it
- Solution URL: https://www.frontendmentor.io/solutions/ecommerce-product-page-using-vite-vue-ts-and-tailwind-css-sUBATQ_OSR
- Live Site URL: https://frontend-mentor-ecommerce-product-page-enreina.vercel.app/
- Vue.js
- Vite
- Tailwind CSS
- Mobile-first workflow
- [Vue] Composition API vs Options API
- [Vue] State Management
- [Vue] Transition
- [Tailwind CSS] Breakpoints & Responsive Layout
- [Tailwind CSS] Removing spinner on Number Input
- [Tailwind CSS] Styling based on parent state (group-{modifier})
The shopping cart functionality is implemented using Vue's Reactivity API as described in the official guide. In the case of this project, which is a single product page, it works because we don't expect user to go to different product page. In a real e-commerce website, however, this approach wouldn't work because the shopping cart would be reset to be empty once user refreshes the page.
As a next challenge, I would like to try and build a more full-fledged e-commerce website using Vue and learn more about how to use Pinia, the state management library that's supposedly could overcome the limitation of the approach used in this project.