Overview
High-quality images are fundamental to Zomato's user experience, showcasing restaurant ambiance and delectable dishes. An intuitive and responsive image gallery is a critical component on any restaurant's page. This problem challenges you to build a dynamic image gallery that allows users to browse thumbnails and view selected images in a detailed 'focus' mode, simulating a common interaction pattern on our platform.
What you need to do / Task
Your goal is to implement a React component that displays a collection of food images and provides an interactive focus view. Specifically, you must:
- Display Image Thumbnails: Render a gallery of image thumbnails using the provided mock data.
- Open Focus View: When a user clicks on an image thumbnail, open a modal-like 'focus view' displaying the larger version of the selected image along with its title and description.
- Navigate Images: Within the focus view, provide controls (e.g., 'Next' and 'Previous' buttons) to allow users to cycle through the images in the gallery. Navigation should wrap around (i.e., from the last image to the first, and vice-versa).
- Close Focus View: Implement a clear mechanism to close the focus view (e.g., a close button, clicking outside the image area).
UI/UX expectations
- Gallery Layout: Thumbnails should be arranged in a visually appealing grid or flex layout.
- Focus View Presentation: The focus view should appear as an overlay or modal that covers most of the screen, centering the selected image and its details.
- Interactive Elements: Navigation buttons (Next/Previous) and a close button (
X icon) should be clearly visible and functional within the focus view.
- Responsiveness: The focus view should ideally be centered and adapt reasonably well to different screen sizes (e.g., full width on smaller screens, constrained width on larger screens).
- Accessibility (Bonus): While not strictly required for the time limit, consider basic accessibility for interactive elements.
Acceptance criteria
- All mock images are displayed as clickable thumbnails in the main gallery view.
- Clicking any thumbnail opens a focus view showing the full-size image, title, and description corresponding to the clicked thumbnail.
- The focus view includes a 'Next' button that, when clicked, displays the subsequent image in the
IMAGES array (wrapping from last to first).
- The focus view includes a 'Previous' button that, when clicked, displays the prior image in the
IMAGES array (wrapping from first to last).
- The focus view has a 'Close' button or allows clicking on the overlay to close it, returning to the gallery view.
- The UI should be reasonably styled using the provided CSS, or your own additions, to match a pleasant user experience.