About the exercise
Requirements
- The photo, name, and price of each product must be visible at all times.
- As many rows as desired can be created as long as there are elements in the row.
- Rows must have between 1 and 3 elements.
- Users must be able to add elements to rows and exchange them between different created rows or between the elements of the same row using drag and drop.
- Users must be able to move rows of position.
- You can zoom in and out on the grid editor. If you add many rows, you lose the context of how the grid would look. Zoom makes it easy to see the maximum number of rows possible. This zoom should only be done on the editor area and not on the entire page, so you cannot use the native browser zoom.
- A template can be associated and disassociated with a row.
- Users must see the name of the template that a particular row has.
- In addition to seeing the name, users must see from the application how the alignment would look according to the template they have selected. In other words, if the right-alignment template is selected, the products must be aligned to the right in the editor.
- Users can save the grid, but all rows must have products and all rows must have a template assigned.
Steps followed
- Fork a vercel's repo with a basic template. Remove unnecessary stuff.
- Create the mock Products service
- Create a basic Products page
- Implement a basic horizontal drag and drop for Products page
- Create multiple rows of draggable Products page
- Buttons to add and remove rows in Products page
- Draggable rows in Products page
- Limit the number of items per row in Products page
- Buttons to add items to the row
- Create the
/templates
endpoint and service - Create templates selector button
- Zoom functionality to Products Page
- I found a bug in the
beautiful-drag-n-drop
functionality that does not allow for scaled items to be dragged around. I decided to disable the feature while scaling.
- I found a bug in the
- Create the
/grids
endpoint to POST grids and to GET grids - Add updateGrid function and refactor createGrid to handle updates
- Document the requirements of the exercise
- Visual fixes and UX improvements
- Navbar to be readable on dark and light settings
- Create a Card for the product and use it in products and grid pages
- Responsive view for Grid. Dark theme improvement for the card
- Refactor "Add product" button to be like a card placeholder
- Responsive design for Products page
- Functionality to remove items
- Link in Products page to the grid view