Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tooltip and popup markers #5

Merged
merged 48 commits into from
May 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
eaa0a9b
Added getting information about icons from Figma
matthew44-mappable Mar 19, 2024
b1fa646
Added getting links to icons
matthew44-mappable Mar 19, 2024
65fffaa
restructuring inside the tools folder
matthew44-mappable Mar 19, 2024
2fc239a
Fetching components only with export settings
matthew44-mappable Mar 19, 2024
72848f5
load icon in local folder
matthew44-mappable Mar 29, 2024
b2d08a0
uploading icons from Figma to a local folder
matthew44-mappable Apr 1, 2024
67864b5
export only svg files
matthew44-mappable Apr 1, 2024
60983d8
refactor
matthew44-mappable Apr 1, 2024
4bb1291
optimize svg and filter fallback icons
matthew44-mappable Apr 1, 2024
073ad56
generate types for icons
matthew44-mappable Apr 1, 2024
ea93e84
generate icons list in md file
matthew44-mappable Apr 1, 2024
9a52d37
filter fill-opacity icons
matthew44-mappable Apr 1, 2024
82e2749
default marker
matthew44-mappable Apr 1, 2024
eed3917
add nanospinner in cli tool
matthew44-mappable Apr 1, 2024
1476307
path as common constants, nanospinner error in catch
matthew44-mappable Apr 2, 2024
07c1a4b
show pin with icon
matthew44-mappable Apr 2, 2024
8ff8c5e
fetch colors from Figma
matthew44-mappable Apr 3, 2024
bcc0b34
color props
matthew44-mappable Apr 3, 2024
4454824
optional props
matthew44-mappable Apr 4, 2024
71e6487
custom color
matthew44-mappable Apr 4, 2024
351f302
add fallback icon
matthew44-mappable Apr 4, 2024
d7aadc4
size props in marker
matthew44-mappable Apr 8, 2024
6e92501
Downscale if no small icon
matthew44-mappable Apr 8, 2024
10aef04
upgrade markers
matthew44-mappable Apr 10, 2024
3a9b8b9
download icons
matthew44-mappable Apr 11, 2024
530b4b6
fix
matthew44-mappable Apr 11, 2024
074a182
took chunk function from lodash
matthew44-mappable Apr 18, 2024
c5b89e9
rename generated files
matthew44-mappable Apr 18, 2024
41328c2
add tooltip marker
matthew44-mappable Apr 15, 2024
90d16ca
tooltip combined positions, tooltip offset
matthew44-mappable Apr 15, 2024
5999b7f
support dark theme
matthew44-mappable Apr 15, 2024
8a0d7c4
separated tooltip and balloon
matthew44-mappable Apr 15, 2024
d254b25
add default popup
matthew44-mappable Apr 17, 2024
cd1d6e9
remove close callback from popup content
matthew44-mappable Apr 17, 2024
878dabe
remove mock MMapPopupMarker
matthew44-mappable Apr 17, 2024
60068f4
add overrides
matthew44-mappable Apr 18, 2024
38f69ad
popups examples
matthew44-mappable Apr 18, 2024
055e07e
add unit-tests
matthew44-mappable Apr 18, 2024
e2a9d4c
add prefix in css
matthew44-mappable Apr 22, 2024
4e07036
add open animations
matthew44-mappable Apr 22, 2024
e1a9bed
remove __impl
matthew44-mappable Apr 25, 2024
c96c272
add popup in default marker
matthew44-mappable Apr 26, 2024
4464bb9
fix popup in marker
matthew44-mappable Apr 27, 2024
df1d06a
Rename ballon to popup
matthew44-mappable May 8, 2024
e2ca0f3
Rename tooltip to text-popup
matthew44-mappable May 8, 2024
838ffd0
fix issues
matthew44-mappable May 13, 2024
b342f2a
remove text popup and default popup
matthew44-mappable May 13, 2024
3ed3960
fix
matthew44-mappable May 14, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions example/marker-popup/common.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import type {LngLat, MMapLocationRequest} from '@mappable-world/mappable-types';

export const CENTER: LngLat = [55.442795, 25.24107];

export const LOCATION: MMapLocationRequest = {center: CENTER, zoom: 9};
36 changes: 36 additions & 0 deletions example/marker-popup/react/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<!doctype html>
<html>
<head>
<title>React example mappable-default-ui-theme</title>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1" />
<script crossorigin src="https://unpkg.com/react@17/umd/react.production.min.js"></script>
<script crossorigin src="https://unpkg.com/react-dom@17/umd/react-dom.production.min.js"></script>
<script crossorigin src="https://unpkg.com/@babel/standalone@7/babel.min.js"></script>
<script src="https://js.api.mappable.world/3.0/?apikey=%APIKEY%&lang=en_US"></script>

<script
data-plugins="transform-modules-umd"
data-presets="react, typescript"
type="text/babel"
src="../../index.ts"
></script>
<script
data-plugins="transform-modules-umd"
data-presets="react, typescript"
type="text/babel"
src="../common.ts"
></script>
<script
data-plugins="transform-modules-umd"
data-presets="react, typescript"
type="text/babel"
src="./index.tsx"
></script>

<link rel="stylesheet" href="../../index.css" />
</head>
<body>
<div id="app"></div>
</body>
</html>
45 changes: 45 additions & 0 deletions example/marker-popup/react/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import {MarkerSizeProps} from '../../src';
import {CENTER, LOCATION} from '../common';

window.map = null;

main();
async function main() {
const [mappableReact] = await Promise.all([mappable.import('@mappable-world/mappable-reactify'), mappable.ready]);
const reactify = mappableReact.reactify.bindTo(React, ReactDOM);

const {MMap, MMapDefaultSchemeLayer, MMapDefaultFeaturesLayer, MMapControls, MMapControlButton} =
reactify.module(mappable);

const {useState, useCallback, useMemo} = React;

const {MMapDefaultMarker} = reactify.module(await mappable.import('@mappable-world/mappable-default-ui-theme'));

ReactDOM.render(
<React.StrictMode>
<App />
</React.StrictMode>,
document.getElementById('app')
);

function App() {
const [location] = useState(LOCATION);
const [size, setSize] = useState<MarkerSizeProps>('normal');
const popup = useMemo(() => ({content: () => <span>Marker popup</span>}), []);

return (
<MMap location={location} ref={(x) => (map = x)}>
<MMapDefaultSchemeLayer />
<MMapDefaultFeaturesLayer />

<MMapDefaultMarker coordinates={CENTER} iconName="fallback" size={size} popup={popup} />

<MMapControls position="top left">
<MMapControlButton text="Normal" onClick={useCallback(() => setSize('normal'), [])} />
<MMapControlButton text="Small" onClick={useCallback(() => setSize('small'), [])} />
<MMapControlButton text="Micro" onClick={useCallback(() => setSize('micro'), [])} />
</MMapControls>
</MMap>
);
}
}
34 changes: 34 additions & 0 deletions example/marker-popup/vanilla/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<!doctype html>
<html>
<head>
<title>Vanilla example mappable-default-ui-theme</title>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1" />
<script crossorigin src="https://unpkg.com/@babel/standalone@7/babel.min.js"></script>
<script src="https://js.api.mappable.world/3.0/?apikey=%APIKEY%&lang=en_US"></script>

<script
data-plugins="transform-modules-umd"
data-presets="react, typescript"
type="text/babel"
src="../../index.ts"
></script>
<script
data-plugins="transform-modules-umd"
data-presets="typescript"
type="text/babel"
src="../common.ts"
></script>
<script
data-plugins="transform-modules-umd"
data-presets="typescript"
type="text/babel"
src="./index.ts"
></script>

<link rel="stylesheet" href="../../index.css" />
</head>
<body>
<div id="app"></div>
</body>
</html>
38 changes: 38 additions & 0 deletions example/marker-popup/vanilla/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import {CENTER, LOCATION} from '../common';
window.map = null;

main();
async function main() {
await mappable.ready;
const {MMap, MMapDefaultSchemeLayer, MMapDefaultFeaturesLayer, MMapControls, MMapControlButton} = mappable;

const {MMapDefaultMarker} = await mappable.import('@mappable-world/mappable-default-ui-theme');

map = new MMap(document.getElementById('app'), {location: LOCATION});

map.addChild(new MMapDefaultSchemeLayer({}));
map.addChild(new MMapDefaultFeaturesLayer({}));

const marker = new MMapDefaultMarker({
coordinates: CENTER,
iconName: 'fallback',
size: 'normal',
popup: {
content: () => {
const popup = document.createElement('span');
popup.textContent = 'Marker popup';
return popup;
}
}
});

map.addChild(marker);

map.addChild(
new MMapControls({position: 'top left'}, [
new MMapControlButton({text: 'Normal', onClick: () => marker.update({size: 'normal'})}),
new MMapControlButton({text: 'Small', onClick: () => marker.update({size: 'small'})}),
new MMapControlButton({text: 'Micro', onClick: () => marker.update({size: 'micro'})})
])
);
}
35 changes: 35 additions & 0 deletions example/marker-popup/vue/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<!doctype html>
<html>
<head>
<title>Vue example mappable-default-ui-theme</title>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1" />
<script crossorigin src="https://unpkg.com/vue@3/dist/vue.global.js"></script>
<script crossorigin src="https://unpkg.com/@babel/standalone@7/babel.min.js"></script>
<script src="https://js.api.mappable.world/3.0/?apikey=%APIKEY%&lang=en_US"></script>

<script
data-plugins="transform-modules-umd"
data-presets="react, typescript"
type="text/babel"
src="../../index.ts"
></script>
<script
data-plugins="transform-modules-umd"
data-presets="typescript"
type="text/babel"
src="../common.ts"
></script>
<script
data-plugins="transform-modules-umd"
data-presets="typescript"
type="text/babel"
src="./index.ts"
></script>

<link rel="stylesheet" href="../../index.css" />
</head>
<body>
<div id="app"></div>
</body>
</html>
53 changes: 53 additions & 0 deletions example/marker-popup/vue/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
import {MarkerSizeProps} from '../../src';
import {CENTER, LOCATION} from '../common';

window.map = null;

main();
async function main() {
const [mappableVue] = await Promise.all([mappable.import('@mappable-world/mappable-vuefy'), mappable.ready]);
const vuefy = mappableVue.vuefy.bindTo(Vue);

const {MMap, MMapDefaultSchemeLayer, MMapDefaultFeaturesLayer, MMapControls, MMapControlButton} =
vuefy.module(mappable);

const {MMapDefaultMarker} = vuefy.module(await mappable.import('@mappable-world/mappable-default-ui-theme'));

const app = Vue.createApp({
components: {
MMap,
MMapDefaultSchemeLayer,
MMapDefaultFeaturesLayer,
MMapControls,
MMapControlButton,
MMapDefaultMarker
},
setup() {
const size = Vue.ref<MarkerSizeProps>('normal');
const refMap = (ref: any) => {
window.map = ref?.entity;
};
const setNormalSize = () => (size.value = 'normal');
const setSmallSize = () => (size.value = 'small');
const setMicroSize = () => (size.value = 'micro');

return {LOCATION, CENTER, size, refMap, setNormalSize, setSmallSize, setMicroSize};
},
template: `
<MMap :location="LOCATION" :ref="refMap">
<MMapDefaultSchemeLayer />
<MMapDefaultFeaturesLayer />
<MMapDefaultMarker :coordinates="CENTER" iconName="fallback" :size="size">
<template #popupContent>
<span>Marker popup</span>
</template>
</MMapDefaultMarker>
<MMapControls position="top left">
<MMapControlButton text="Normal" :onClick="setNormalSize" />
<MMapControlButton text="Small" :onClick="setSmallSize" />
<MMapControlButton text="Micro" :onClick="setMicroSize" />
</MMapControls>
</MMap>`
});
app.mount('#app');
}
1 change: 1 addition & 0 deletions example/popups-on-map/close.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
81 changes: 81 additions & 0 deletions example/popups-on-map/common.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
.popup {
display: flex;
flex-direction: column;
row-gap: 8px;
}

.header {
display: flex;
flex-direction: row;
justify-content: space-between;
gap: 8px;
padding-right: 20px;

.header_title {
font-size: 16px;
font-weight: 400;
line-height: 22px;
color: #050d33;
}
.header_close {
position: absolute;
top: 0;
right: 0;
display: flex;
justify-content: center;
align-items: center;
width: 32px;
height: 32px;
border: none;
background: none;
color: #c8c9cc;
cursor: pointer;
background-image: url('./close.svg?inline');
background-position: center;
background-repeat: no-repeat;
}
}

.description {
font-size: 14px;
font-weight: 400;
line-height: 20px;
color: #7b7d85;
}

.action {
width: max-content;
padding: 12px 16px;
border-radius: 8px;
border: none;
background-color: #eefd7d;
transition: background-color 0.1s ease-out;
color: #050d33;
text-align: center;
cursor: pointer;
white-space: normal;

font-size: 14px;
font-style: normal;
font-weight: 500;
line-height: 16px;
}

.action:hover {
background-color: #e5fd30;
}

._dark {
.header_title {
color: #f2f5fa;
}
.header_close {
color: #46464d;
}
.description {
color: #7b7d85;
}
.action {
background-color: #d6fd63;
}
}
12 changes: 12 additions & 0 deletions example/popups-on-map/common.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import type {MMapLocationRequest, LngLat} from '@mappable-world/mappable-types';

export const CENTER: LngLat = [55.442795, 25.24107];
export const LOCATION: MMapLocationRequest = {center: CENTER, zoom: 14};

export const POPUP_TEXT = 'Default text popup';
export const CUSTOM_POPUP_COORDS: LngLat = [CENTER[0] - 0.02, CENTER[1]];
export const TEXT_POPUP_COORDS: LngLat = [CENTER[0] + 0.02, CENTER[1]];

export const TITLE = 'Default popup marker';
export const DESCRIPTION = 'Description for default popup';
export const ACTION = 'Make an action';
37 changes: 37 additions & 0 deletions example/popups-on-map/react/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<!doctype html>
<html>
<head>
<title>React example mappable-default-ui-theme</title>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1" />
<script crossorigin src="https://unpkg.com/react@17/umd/react.production.min.js"></script>
<script crossorigin src="https://unpkg.com/react-dom@17/umd/react-dom.production.min.js"></script>
<script crossorigin src="https://unpkg.com/@babel/standalone@7/babel.min.js"></script>
<script src="https://js.api.mappable.world/3.0/?apikey=%APIKEY%&lang=en_US"></script>

<script
data-plugins="transform-modules-umd"
data-presets="react, typescript"
type="text/babel"
src="../../index.ts"
></script>
<script
data-plugins="transform-modules-umd"
data-presets="react, typescript"
type="text/babel"
src="../common.ts"
></script>
<script
data-plugins="transform-modules-umd"
data-presets="react, typescript"
type="text/babel"
src="./index.tsx"
></script>

<link rel="stylesheet" href="../../index.css" />
<link rel="stylesheet" href="../common.css" />
</head>
<body>
<div id="app"></div>
</body>
</html>
Loading
Loading