Skip to content

Commit 42d288c

Browse files
author
Herve Tribouilloy
committed
Reverted widget to shadowDOM mode
1 parent 63fc937 commit 42d288c

4 files changed

Lines changed: 13 additions & 5 deletions

File tree

vite_project/index.html

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
<body>
22
<script type="module" src="./src/widget.ts"></script>
33

4-
<div data-widget-container="regionmap"
5-
data-load="eager"
4+
<div data-load="eager"
65
data-page="home"
76
data-src="https://widget.regionmap.co.uk:8448/widget-regionmap.iife.js"
87
>

vite_project/src/components/RegionMap.tsx

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,16 @@ interface RegionMapProps {
1313
export function RegionMap({ title, region, center, zoom }: RegionMapProps) {
1414
const { googleMapsApiKey } = useSystemState()
1515

16+
const containerStyle = useMemo(
17+
() => ({
18+
width: "100%",
19+
height: "350px",
20+
borderRadius: "12px",
21+
overflow: "hidden"
22+
}),
23+
[]
24+
);
25+
1626
const polygonOptions = useMemo(
1727
() => ({
1828
strokeColor: "#7b1fa2",
@@ -28,7 +38,7 @@ export function RegionMap({ title, region, center, zoom }: RegionMapProps) {
2838
<LoadScript googleMapsApiKey={googleMapsApiKey}>
2939
<h3 data-regionmap-title>{title}</h3>
3040
<GoogleMap
31-
mapContainerClassName="re-regionmap"
41+
mapContainerStyle={containerStyle}
3242
center={center}
3343
zoom={zoom}
3444
options={{

vite_project/src/hooks/useWidgetConfig.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export function useWidgetConfig(host: HTMLElement): ResolvedRegionMapConfig | nu
1818
const runtime = readIntegrationConfig();
1919
const resolved = resolveWidgetConfig(widgetConfig, runtime);
2020

21-
activity('bootstrap', 'Config resolved', {
21+
activity('bootstrap', 'Widget config', {
2222
data: resolved.data,
2323
integrations: resolved.integrations
2424
});

vite_project/src/lib/hostReader.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
export function getMountedHost(hostElement: HTMLElement) {
2-
return hostElement;
32
const shadow =
43
hostElement.shadowRoot || hostElement.attachShadow({ mode: "open" });
54

0 commit comments

Comments
 (0)