Overview
Amazon's scale demands clear visualization of its vast organizational structure. Understanding reporting lines is crucial for team collaboration and navigating internal processes. This problem asks you to build a simple web component to display a hierarchical organizational chart. This exercise assesses your ability to structure UI components, handle hierarchical data, and manage state for interactive elements, which are fundamental skills for building many internal tools at Amazon.
What you need to do / Task
- Render the Org Chart: Display a tree-like structure representing the reporting hierarchy. Each node should clearly show the employee's
name and title.
- Expand/Collapse Functionality: Implement a toggle mechanism (e.g., a button or icon) next to each manager's name. Clicking this toggle should expand or collapse their direct reports. Initially, only the top-level manager should be expanded, showing their direct reports. All other sub-levels should be collapsed.
- Visual Indication: When a manager's reports are collapsed, there should be a clear visual indicator (e.g., a
+ symbol or an arrow pointing right). When expanded, a different indicator (e.g., a - symbol or an arrow pointing down) should be displayed.
UI/UX expectations
- Layout: Use a simple nested list or
div structure to represent the hierarchy. Indentation should clearly show reporting lines.
- Interactions: The expand/collapse toggle should be easily clickable.
- Accessibility: Ensure the toggle is keyboard-navigable and has appropriate ARIA attributes (e.g.,
aria-expanded).
- Styling: Basic styling for readability and visual hierarchy is sufficient. No need for elaborate designs, but the structure should be clear.
Acceptance criteria
- The root employee (CEO) is always visible.
- Initially, only the CEO's direct reports are visible; all other sub-levels are collapsed.
- Clicking an expand/collapse toggle correctly shows/hides the direct reports of that employee.
- The visual indicator for expand/collapse accurately reflects the current state.
- Each employee node displays their name and title.
- The UI remains responsive and functional during interactions.