Skip to content

Commit 4780e4a

Browse files
cioddijannik brack
andauthored
fix MlMarker and improve performance by using a maplibre marker inste… (#216)
…ad of an absolute positioned HTML element --------- Co-authored-by: jannik brack <[email protected]>
1 parent dd5baf4 commit 4780e4a

File tree

2 files changed

+273
-119
lines changed

2 files changed

+273
-119
lines changed

src/components/MlMarker/MlMarker.stories.tsx

Lines changed: 127 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,137 @@ import MlMarker, { MlMarkerProps } from "./MlMarker";
55
import mapContextDecorator from "../../decorators/MapContextDecorator";
66

77
const storyoptions = {
8-
title: "MapComponents/MlMarker",
9-
component: MlMarker,
10-
decorators: mapContextDecorator,
8+
title: "MapComponents/MlMarker",
9+
component: MlMarker,
10+
decorators: mapContextDecorator,
1111
};
1212
export default storyoptions;
1313

14-
const Template = (args:MlMarkerProps) => <MlMarker {...args}/>;
14+
const Template = (args: MlMarkerProps) => <MlMarker {...args} />;
1515

1616
export const ExampleConfig = Template.bind({});
1717
ExampleConfig.args = {
18-
content: 'WhereGroup',
19-
lng: 7.0851268,
20-
lat: 50.73884,
21-
mapId: 'map_1',
18+
lng: 7.0851268,
19+
lat: 50.73884,
20+
mapId: 'map_1',
21+
content: `
22+
<div style="padding: 12px; font-family: Arial, sans-serif; max-width: 220px;">
23+
<div style="font-size: 18px; font-weight: bold; margin-bottom: 8px; color: #3b82f6;">WhereGroup</div>
24+
<div style="display: flex; align-items: center; margin-bottom: 10px;">
25+
<span style="color: #6b7280; font-size: 14px;">Bonn, Germany</span>
26+
</div>
27+
<p>
28+
Geospatial technologies and open-source GIS solutions.
29+
</p>
30+
<div style="font-size: 13px; color: #6b7280;">
31+
<div>📍 50.73884, 7.0851268</div>
32+
</div>
33+
</div>
34+
`,
35+
containerStyle: {
36+
borderRadius: "8px",
37+
boxShadow: "0 4px 12px rgba(0,0,0,0.1)",
38+
overflow: "hidden",
39+
backgroundColor: "white"
40+
}
41+
};
42+
43+
export const CustomStyledMarker = Template.bind({});
44+
CustomStyledMarker.args = {
45+
lng: 7.0851268,
46+
lat: 50.73884,
47+
anchor: "top-right",
48+
markerStyle: {
49+
width: "15px",
50+
height: "15px",
51+
background: "linear-gradient(135deg, #f093fb 0%, #f5576c 100%)",
52+
border: "2px solid rgba(255, 255, 255, 0.7)",
53+
borderRadius: "50%",
54+
boxShadow: "0 6px 12px rgba(90,0,0,0.2), 0 0 0 4px rgba(240,147,251,0.2)"
55+
},
56+
containerStyle: {
57+
backgroundColor: "rgba(255, 255, 255, 0.9)",
58+
boxShadow: "4px 12px 24px rgba(0,0,0,0.15)",
59+
borderRadius: "14px",
60+
border: "1px solid rgba(200, 200, 200, 0.3)",
61+
backdropFilter: "blur(12px)",
62+
maxWidth: "300px"
63+
},
64+
iframeBodyStyle: {
65+
fontFamily: "system-ui, -apple-system, BlinkMacSystemFont, sans-serif",
66+
},
67+
iframeStyle: {
68+
borderRadius: "14px",
69+
overflow: "hidden"
70+
},
71+
content: `
72+
<style>
73+
.custom-marker-container {
74+
padding: 16px;
75+
color: #444;
76+
}
77+
.custom-marker-header {
78+
font-size: 18px;
79+
font-weight: 600;
80+
color: #f5576c;
81+
margin-bottom: 10px;
82+
}
83+
.custom-marker-details {
84+
display: flex;
85+
margin-bottom: 12px;
86+
align-items: center;
87+
}
88+
.custom-marker-icon {
89+
width: 38px;
90+
height: 38px;
91+
background: #ffe0ed;
92+
border-radius: 50%;
93+
display: flex;
94+
align-items: center;
95+
justify-content: center;
96+
margin-right: 12px;
97+
}
98+
.custom-marker-icon-content {
99+
color: #f5576c;
100+
font-size: 16px;
101+
}
102+
.custom-marker-info {
103+
font-weight: 500;
104+
}
105+
.custom-marker-subinfo {
106+
font-size: 13px;
107+
color: #777;
108+
margin-top: 2px;
109+
}
110+
.custom-marker-box {
111+
background: #ffe0ed;
112+
border-radius: 8px;
113+
padding: 10px;
114+
font-size: 13px;
115+
}
116+
.custom-marker-box div {
117+
margin-bottom: 4px;
118+
}
119+
.custom-marker-status {
120+
color: #22c55e;
121+
}
122+
</style>
123+
<div class="custom-marker-container">
124+
<div class="custom-marker-header">Location Details</div>
125+
<div class="custom-marker-details">
126+
<div class="custom-marker-icon">
127+
<div class="custom-marker-icon-content">📍</div>
128+
</div>
129+
<div>
130+
<div class="custom-marker-info">WhereGroup Headquarters</div>
131+
<div class="custom-marker-subinfo">Bonn, Germany</div>
132+
</div>
133+
</div>
134+
<div class="custom-marker-box">
135+
<div><strong>Coordinates:</strong> 50.73884, 7.0851268</div>
136+
<div><strong>Status:</strong> <span class="custom-marker-status">Active</span></div>
137+
<div><strong>Last updated:</strong> Today</div>
138+
</div>
139+
</div>
140+
`
22141
};

0 commit comments

Comments
 (0)