A lightweight API for interactive hotel maps with Mapbox integration
npm install glcvdv-lite-api-mapA lightweight JavaScript library for creating interactive hotel maps with Mapbox integration. Easily display hotels on a map with filtering capabilities and beautiful UI.
``bash`
npm install lite-api
`javascript
import LiteAPI from 'lite-api';
// Initialize the map
const map = await LiteAPI.Map.init('#map-container', {
liteApiApiKey: 'your-api-key',
placeId: 'your-place-id',
language: 'EN',
currency: 'EUR'
});
`
`javascript`
const map = await LiteAPI.Map.init('#map-container', {
liteApiApiKey: 'your-api-key',
placeId: 'your-place-id',
language: 'EN',
currency: 'EUR',
markerColor: '#ff6b6b',
clusters: {
maxZoom: 14,
radius: 50,
colors: ['#ff6b6b', '#4ecdc4', '#45b7d1']
}
});
`javascript`
// Filter hotels by date and guests
await map.filter({
checkin: '2024-01-15',
checkout: '2024-01-20',
adults: 2,
children: [8, 12],
minRating: 4
});
| Property | Type | Required | Description |
|----------|------|----------|-------------|
| liteApiApiKey | string | Yes | Your Lite API key |placeId
| | string | Yes | The place ID to display hotels for |language
| | 'EN' \| 'IT' | No | Language for hotel data (default: 'EN') |currency
| | 'EUR' \| 'USD' | No | Currency for rates (default: 'EUR') |markerColor
| | string | No | Custom color for map markers |clusters
| | boolean \| object | No | Enable/configure marker clustering |
| Property | Type | Description |
|----------|------|-------------|
| checkin | string | Check-in date (YYYY-MM-DD) |checkout
| | string | Check-out date (YYYY-MM-DD) |adults
| | number | Number of adult guests |children
| | number[] | Ages of child guests |currency
| | string | Currency for filtering |language
| | string | Language for filtering |minRating
| | number | Minimum hotel rating |
- Mapbox GL JS (automatically included as a peer dependency)
- A valid Lite API key
- A place ID for the location you want to display
This library works in all modern browsers that support ES6 modules and the Mapbox GL JS library.
MIT
1. Fork the repository
2. Create your feature branch (git checkout -b feature/amazing-feature)git commit -m 'Add some amazing feature'
3. Commit your changes ()git push origin feature/amazing-feature`)
4. Push to the branch (
5. Open a Pull Request