This portfolio includes an interactive Mapbox map in the contact section. Follow these steps to set it up:
- Go to Mapbox Account
- Sign up for a free account if you don't have one
- Create a new access token or use the default public token
- Copy your access token
- Create a
.env.localfile in the project root (already created) - Replace the placeholder token with your actual Mapbox token:
# Replace with your actual Mapbox access token
VITE_MAPBOX_ACCESS_TOKEN=pk.eyJ1IjoieW91cnVzZXJuYW1lIiwiYSI6ImNsxxxxxxxxxxxxxxx
# Optional: Customize map location (defaults to NYC)
VITE_MAP_LONGITUDE=-74.006
VITE_MAP_LATITUDE=40.7128
VITE_MAP_ZOOM=10To change the map location to your preferred coordinates:
- Find your coordinates using LatLong.net
- Update the environment variables:
VITE_MAP_LONGITUDE: Your longitudeVITE_MAP_LATITUDE: Your latitudeVITE_MAP_ZOOM: Zoom level (1-20, where 20 is closest)
The integrated map includes:
- Dark Theme: Matches the portfolio's dark aesthetic
- Custom Marker: Blue marker indicating your location/availability
- Interactive Popup: Shows contact information
- Navigation Controls: Zoom and pan controls
- Responsive Design: Works on all device sizes
Edit src/components/features/MapBox.tsx and modify the style property:
style: 'mapbox://styles/mapbox/dark-v11', // Current dark theme
// Other options:
// 'mapbox://styles/mapbox/streets-v12'
// 'mapbox://styles/mapbox/satellite-v9'
// 'mapbox://styles/mapbox/light-v11'Change the marker color in the MapBox component:
const marker = new mapboxgl.Marker({
color: '#3B82F6', // Change this hex color
scale: 1.2
})Modify the popup HTML in the MapBox component to show different information.
Mapbox free tier includes:
- 50,000 map loads per month
- 50,000 geocoding requests per month
- Perfect for portfolio websites
Map not loading?
- Check your access token is correct
- Ensure
.env.localfile is in the project root - Restart the development server after adding environment variables
Invalid coordinates?
- Longitude should be between -180 and 180
- Latitude should be between -90 and 90
Styling issues?
- The map uses CSS-in-JS for custom styling
- Check browser console for any CSS conflicts
When deploying to production:
- Add your environment variables to your hosting platform
- Ensure your Mapbox token has the correct URL restrictions
- Consider adding your production domain to Mapbox URL restrictions for security
For Mapbox-specific issues, check: