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

Themable Webcomponent header #684

Merged
merged 2 commits into from
Dec 19, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
4 changes: 3 additions & 1 deletion configs/localConfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@
"height": 90,
"url": "/header/",
"script": "https://cdn.jsdelivr.net/gh/georchestra/header@dist/header.js",
"legacy": false
"legacy": false,
"logoUrl": "https://www.georchestra.org/public/georchestra-logo.svg",
"stylesheet": ""
},
"defaultMapOptions": {
"cesium": {
Expand Down
12 changes: 10 additions & 2 deletions js/plugins/Header.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@
import {useEffect} from "react";
import { createPlugin, connect } from "@mapstore/utils/PluginsUtils";

export const Header = ({url = "/header/", page = "mapstore", height = 90, ignoreIFrame = false, script = "https://cdn.jsdelivr.net/gh/georchestra/header@dist/header.js", legacy = false}) => {
export const Header = ({url = "/header/", page = "mapstore", height = 90, ignoreIFrame = false,
script = "https://cdn.jsdelivr.net/gh/georchestra/header@dist/header.js",

Check failure on line 12 in js/plugins/Header.jsx

View workflow job for this annotation

GitHub Actions / build

Expected indentation of 4 spaces but found 27

Check failure on line 12 in js/plugins/Header.jsx

View workflow job for this annotation

GitHub Actions / build

Expected indentation of 4 spaces but found 27
legacy = false,

Check failure on line 13 in js/plugins/Header.jsx

View workflow job for this annotation

GitHub Actions / build

Expected indentation of 4 spaces but found 27

Check failure on line 13 in js/plugins/Header.jsx

View workflow job for this annotation

GitHub Actions / build

Expected indentation of 4 spaces but found 27
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The CI seems to break only due to linting errors. I guess this can be fixed;-)

logo= "https://www.georchestra.org/public/georchestra-logo.svg",

Check failure on line 14 in js/plugins/Header.jsx

View workflow job for this annotation

GitHub Actions / build

Expected indentation of 4 spaces but found 27

Check failure on line 14 in js/plugins/Header.jsx

View workflow job for this annotation

GitHub Actions / build

Operator '=' must be spaced

Check failure on line 14 in js/plugins/Header.jsx

View workflow job for this annotation

GitHub Actions / build

Expected indentation of 4 spaces but found 27

Check failure on line 14 in js/plugins/Header.jsx

View workflow job for this annotation

GitHub Actions / build

Operator '=' must be spaced
stylesheet= ""}) => {

Check failure on line 15 in js/plugins/Header.jsx

View workflow job for this annotation

GitHub Actions / build

Expected indentation of 4 spaces but found 27

Check failure on line 15 in js/plugins/Header.jsx

View workflow job for this annotation

GitHub Actions / build

Operator '=' must be spaced

Check failure on line 15 in js/plugins/Header.jsx

View workflow job for this annotation

GitHub Actions / build

Expected indentation of 4 spaces but found 27

Check failure on line 15 in js/plugins/Header.jsx

View workflow job for this annotation

GitHub Actions / build

Operator '=' must be spaced
useEffect(() => {
const header = document.getElementById("georchestra-header");
const headerScript = document.getElementById("georchestra-header-script");
Expand All @@ -24,6 +28,8 @@
header.setAttribute("legacy-url", url);
header.setAttribute("legacy-header", legacy);
header.setAttribute("style", `height:${height}px`);
header.setAttribute("logo-url", logo);
header.setAttribute("stylesheet", stylesheet);
headerScript.src = script;

if (container) {
Expand All @@ -41,6 +47,8 @@
url: state.localConfig && state.localConfig.header && state.localConfig.header.url,
height: state.localConfig && state.localConfig.header && state.localConfig.header.height,
script: state.localConfig && state.localConfig.header && state.localConfig.header.script,
legacy: state.localConfig && state.localConfig.header && state.localConfig.header.legacy
legacy: state.localConfig && state.localConfig.header && state.localConfig.header.legacy,
logo: state.localConfig && state.localConfig.header && state.localConfig.header.logo,
stylesheet: state.localConfig && state.localConfig.header && state.localConfig.header.stylesheet
}))(Header)
});
2 changes: 1 addition & 1 deletion web/src/main/resources/mapstore.properties
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@

datadir.location=${georchestra.extensions:},${georchestra.datadir}/mapstore
overrides.config=../default.properties
overrides.mappings=header.url=headerUrl,header.height=headerHeight,header.script=headerScript,header.legacy=useLegacyHeader
overrides.mappings=header.url=headerUrl,header.height=headerHeight,header.script=headerScript,header.legacy=useLegacyHeader,header.logoUrl=logoUrl,header.stylesheet=georchestraStylesheet
Loading