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.
12 lines
404 B
12 lines
404 B
import { useMemo } from 'preact/hooks';
|
|
import type { TotalProps } from './types';
|
|
import { getRouteLength } from '../shared/routes';
|
|
|
|
export const TotalComponent = ({ markers }: TotalProps) => {
|
|
const routeLength = useMemo(
|
|
() => getRouteLength(markers.map(({ coordinates }) => coordinates)),
|
|
[markers],
|
|
);
|
|
|
|
return <>{`Total route length: ${routeLength.toFixed(0)}m`}</>;
|
|
};
|
|
|