To implement or customize a Delivery Tracker block, you need to provide data structures for meals, route coordinates, map viewport, and route styling.
Meal Data
Each meal must follow the DeliveryMeal interface:
name: stringprice: stringquantity: number
Route and Map Configuration
- Coordinates: Define
pickup (origin) and dropoff (destination) using { lng: number, lat: number } objects. - Map View: Configure the
mapView object with center (as [number, number]), zoom, minZoom, and maxZoom. - Progress: Use
progressFraction (a number between 0 and 1) to represent the portion of the route covered.
Route Styling
Route lines are styled using concrete hex colors (WebGL cannot use CSS variables). The routeStyle object supports:
progress: The covered path (includes color, width, and opacity).remaining: The path ahead (includes width, opacity, and a color object with light and dark hex values).
export interface DeliveryMeal {
name: string;
price: string;
quantity: number;
}
export const pickup = { lng: -122.4185, lat: 37.7645 };
export const dropoff = { lng: -122.434, lat: 37.7475 };
export const mapView = {
center: [-122.4263, 37.756] as [number, number],
zoom: 13.6,
minZoom: 12,
maxZoom: 15,
};
export const routeStyle = {
progress: { color: "#3b82f6", width: 6, opacity: 0.95 },
remaining: {
width: 5.2,
opacity: 0.5,
color: { light: "#6b7280", dark: "#9ca3af" },
},
} as const;