Overview
Snap Map allows users to see their friends' locations in real-time. This problem challenges you to build a simplified front-end simulation of a key Snap Map feature: displaying a list of friends and visualizing their approximate locations on an interactive map. This exercise focuses on UI component design, state management, and synchronizing interactions between different parts of the user interface.
What you need to do / Task
Your goal is to build a React application with two main panels: a 'Friends List' and a 'Snap Map' view.
- Render Friends List: Display a scrollable list of friends using the provided mock data. Each list item should show the friend's name.
- Simulate Map View: Implement a basic 'map' component using a
div element. This map will display 'markers' at the simulated coordinates of each friend.
- Synchronized Selection (List to Map): When a friend's name is clicked in the friends list, that friend should be marked as 'selected'. The selected friend's list item should visually change, and their corresponding marker on the map should also visually highlight.
- Synchronized Selection (Map to List): Clicking a marker on the map should select the corresponding friend in the friends list, updating both the list item's visual state and the marker's visual state.
- Single Selection: Only one friend can be selected at any given time. Clicking a new friend (either in the list or on the map) should deselect the previously active friend and select the new one.
UI/UX expectations
- Layout: The application should have a two-panel layout: a 'Friends List' on the left and a 'Snap Map' on the right.
- Friends List: Each friend's name should be clearly clickable. The selected friend's list item should have a distinct visual style (e.g., different background color, bold text).
- Map View: The map area should be a distinct rectangular region. Markers should be simple visual elements (e.g., circles). The selected friend's marker should be visually distinct from unselected markers (e.g., different color, larger size).
- Interactions: Clicks on friend list items and map markers should feel responsive and immediately update the UI across both panels.
- Accessibility: Basic clickable elements with clear visual feedback are expected.
Acceptance criteria
- The friends list correctly renders all friends from the
FRIENDS_DATA mock data.
- Clicking a friend in the list selects them, visually highlighting their name.
- When a friend is selected, their corresponding marker on the map is visually highlighted.
- Only one friend/marker is selected/highlighted at any given time; selecting a new one deselects the old one.
- Clicking a marker on the map correctly selects the corresponding friend in the list and highlights both the list item and the marker.
- The UI consistently reflects the single selected friend across both the list and the map views.