From 210be55363059615ef774b3b68549b8e02ba60d3 Mon Sep 17 00:00:00 2001 From: William French Date: Tue, 28 Apr 2026 12:04:41 -0700 Subject: [PATCH] feat: Migrates the layer-bicycling sample to js-api-samples. --- samples/layer-bicycling/README.md | 41 +++++++++++++++++++++++++++ samples/layer-bicycling/index.html | 22 ++++++++++++++ samples/layer-bicycling/index.ts | 20 +++++++++++++ samples/layer-bicycling/package.json | 14 +++++++++ samples/layer-bicycling/style.css | 17 +++++++++++ samples/layer-bicycling/tsconfig.json | 9 ++++++ 6 files changed, 123 insertions(+) create mode 100644 samples/layer-bicycling/README.md create mode 100644 samples/layer-bicycling/index.html create mode 100644 samples/layer-bicycling/index.ts create mode 100644 samples/layer-bicycling/package.json create mode 100644 samples/layer-bicycling/style.css create mode 100644 samples/layer-bicycling/tsconfig.json diff --git a/samples/layer-bicycling/README.md b/samples/layer-bicycling/README.md new file mode 100644 index 000000000..829ccba9b --- /dev/null +++ b/samples/layer-bicycling/README.md @@ -0,0 +1,41 @@ +# Google Maps JavaScript Sample + +## layer-bicycling + +Bicycling layer sample. + +## Setup + +### Before starting run: + +`npm i` + +### Run an example on a local web server + +`cd samples/layer-bicycling` +`npm start` + +### Build an individual example + +`cd samples/layer-bicycling` +`npm run build` + +From 'samples': + +`npm run build --workspace=layer-bicycling/` + +### Build all of the examples. + +From 'samples': + +`npm run build-all` + +### Run lint to check for problems + +`cd samples/layer-bicycling` +`npx eslint index.ts` + +## Feedback + +For feedback related to this sample, please open a new issue on +[GitHub](https://github.com/googlemaps-samples/js-api-samples/issues). diff --git a/samples/layer-bicycling/index.html b/samples/layer-bicycling/index.html new file mode 100644 index 000000000..c3b681910 --- /dev/null +++ b/samples/layer-bicycling/index.html @@ -0,0 +1,22 @@ + + + + + + Bicycle Layer + + + + + + + + + + + diff --git a/samples/layer-bicycling/index.ts b/samples/layer-bicycling/index.ts new file mode 100644 index 000000000..f2f6d9e88 --- /dev/null +++ b/samples/layer-bicycling/index.ts @@ -0,0 +1,20 @@ +/** + * @license + * Copyright 2026 Google LLC. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0 + */ + +// [START maps_layer_bicycling] +async function initMap(): Promise { + await google.maps.importLibrary("maps"); + + const mapElement = document.querySelector('gmp-map') as google.maps.MapElement; + const innerMap = mapElement.innerMap; + + const bikeLayer = new google.maps.BicyclingLayer(); + + bikeLayer.setMap(innerMap); +} + +initMap(); +// [END maps_layer_bicycling] diff --git a/samples/layer-bicycling/package.json b/samples/layer-bicycling/package.json new file mode 100644 index 000000000..1c41b1ed0 --- /dev/null +++ b/samples/layer-bicycling/package.json @@ -0,0 +1,14 @@ +{ + "name": "@js-api-samples/layer-bicycling", + "version": "1.0.0", + "scripts": { + "build": "tsc && bash ../jsfiddle.sh layer-bicycling && bash ../app.sh layer-bicycling && bash ../docs.sh layer-bicycling && npm run build:vite --workspace=. && bash ../dist.sh layer-bicycling", + "test": "tsc && npm run build:vite --workspace=.", + "start": "tsc && vite build --base './' && vite", + "build:vite": "vite build --base './'", + "preview": "vite preview" + }, + "dependencies": { + + } +} diff --git a/samples/layer-bicycling/style.css b/samples/layer-bicycling/style.css new file mode 100644 index 000000000..438601c1b --- /dev/null +++ b/samples/layer-bicycling/style.css @@ -0,0 +1,17 @@ +/** + * @license + * Copyright 2019 Google LLC. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0 + */ +/* [START maps_layer_bicycling] */ +/* + * Optional: Makes the sample page fill the window. + */ +html, +body { + height: 100%; + margin: 0; + padding: 0; +} + +/* [END maps_layer_bicycling] */ \ No newline at end of file diff --git a/samples/layer-bicycling/tsconfig.json b/samples/layer-bicycling/tsconfig.json new file mode 100644 index 000000000..5ba470c05 --- /dev/null +++ b/samples/layer-bicycling/tsconfig.json @@ -0,0 +1,9 @@ +{ + "extends": "../../tsconfig.base.json", + "compilerOptions": { + "rootDir": "." + }, + "include": [ + "./*.ts", + ] +}