Frontend School

Interactive Zomato Image Gallery with Focus View

Machine Coding
medium

Interactive Zomato Image Gallery with Focus View

Medium
Frontend
React
UI
Image Gallery
Modal
State Management

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:

  1. Display Image Thumbnails: Render a gallery of image thumbnails using the provided mock data.
  2. 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.
  3. 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).
  4. 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.

Constraints

Constraints & assumptions

  • You must use React for building the UI component. Functional components and Hooks are preferred.
  • Mock data for images is provided in App.tsx. No external API calls are required.
  • Focus on client-side rendering; server-side rendering is not needed.
  • No external UI component libraries (e.g., Material UI, Ant Design) are allowed for core gallery/modal functionality. You should build these components yourself. Basic styling can be achieved with plain CSS.
  • The application should run in a standard browser environment.

Out of scope (optional)

  • Advanced image optimization (e.g., lazy loading, different image resolutions).
  • Complex animations or transitions beyond basic CSS effects.
  • Full keyboard accessibility for the focus view (though basic Esc key to close is a nice-to-have).
  • Extensive error handling for image loading.

What interviewers evaluate

  • Component Design & State Management: How effectively you structure your React components and manage the application's state for the gallery and focus view.
  • UI Implementation & Interaction Logic: Accuracy in rendering the UI as per expectations and correctness of interaction logic (thumbnail click, navigation, close).
  • Code Quality & Readability: Adherence to React best practices, code organization, naming conventions, and overall maintainability.
  • Problem Solving & Time Management: Your ability to break down the problem, prioritize, and implement the core features within the given time constraints.

Loading editor...