A customizable Next.js application with Leaflet for creating interactive maps.
- Interactive map with marker clusters
- Filterable user list with search functionality
- Responsive design for mobile and desktop
- Custom pin colors for different departments
- Accordion view for detailed user information
- Synchronized map and list views
- Node.js (18.x or higher)
- npm or yarn
- Clone this repository
git clone https://github.com/your-username/interactive-map.git
cd interactive-map
- Install dependencies
npm install
# or
yarn install
- Configure your data
- Update the API endpoint in src/pages/index.js
- Customize marker icons in src/components/Map/DynamicMap.js
- Modify the data structure in getStaticProps function
- Start the development server
npm run dev
# or
yarn dev
- Open http://localhost:3000 with your browser to see the result
Data Structure The application expects user data with the following structure:
{
data: [
{
attributes: {
Name: "User Name",
Category: "User Category",
Role: "User Role",
Departments: ["Department A"], // Array of departments
Company: "Company Name",
Location: "City, State",
ProfileLink: "https://example.com/profile",
Latitude: 39.8283, // Latitude for map marker
Longitude: -98.5795, // Longitude for map marker
Image: {
data: {
attributes: {
url: "https://example.com/image.jpg"
}
}
}
}
}
]
}
- Place your marker images in the public/images/ directory
- Update the icon definitions in src/components/Map/DynamicMap.js
- Update the departmentIcon mapping to match your departments
Edit the createPopupContent function in src/components/MarkerCluster/MarkerCluster.js to customize the information displayed in map popups.
Modify the userDepartments array and related filter components in src/pages/index.js to customize the filter options available to users.
npm run build
# or
yarn build
This application is built with: