Small preact-based (like React.js) project https://inga-lovinde.github.io/static/komoot-demo/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

55 lines
1.3 KiB

import { Coordinates, Waypoint } from '../shared/types';
export type Marker = Waypoint & {
key: string;
remove: () => void;
moveUp: () => void;
moveDown: () => void;
label: string;
};
type GenericReducerAction<TType extends string, TData> = {
type: TType;
data: TData;
};
export type ReducerAction =
| GenericReducerAction<
'add',
{
coordinates: Coordinates;
remove: (key: string) => void;
moveUp: (key: string) => void;
moveDown: (key: string) => void;
}
>
| GenericReducerAction<'remove', { key: string }>
| GenericReducerAction<'moveUp', { key: string }>
| GenericReducerAction<'moveDown', { key: string }>
| GenericReducerAction<'reorder', { oldIndex: number; newIndex: number }>;
export type ReorderMarkersParams = {
oldIndex: number;
newIndex: number;
};
export type MarkersProps = {
markers: Marker[];
onMarkersReorder: (params: ReorderMarkersParams) => void;
};
export type MapProps = {
markers: Marker[];
onMapClick: (coordinates: Coordinates) => void;
};
export type ExportProps = {
markers: Marker[];
};
export type MarkerProps = {
marker: Marker;
isFirst: boolean;
isLast: boolean;
};