From 497d5c1b4964955b632eab6210079a28192b3b6f Mon Sep 17 00:00:00 2001 From: Pieter Vander Vennet Date: Wed, 29 Jul 2020 16:46:45 +0200 Subject: [PATCH] Add sublte-button, add different icon for popout --- UI/Base/SubtleButton.ts | 27 +++++++++++++++++++++++++++ UI/MoreScreen.ts | 35 +++++++++++++++++++---------------- assets/pop-out.svg | 7 +++++++ index.css | 9 +++++++-- index.ts | 5 +++-- 5 files changed, 63 insertions(+), 20 deletions(-) create mode 100644 UI/Base/SubtleButton.ts create mode 100644 assets/pop-out.svg diff --git a/UI/Base/SubtleButton.ts b/UI/Base/SubtleButton.ts new file mode 100644 index 0000000..444e71a --- /dev/null +++ b/UI/Base/SubtleButton.ts @@ -0,0 +1,27 @@ +import {UIElement} from "../UIElement"; +import Translations from "../i18n/Translations"; +import Combine from "./Combine"; + + +export class SubtleButton extends UIElement{ + private imageUrl: string; + private message: UIElement; + + constructor(imageUrl: string, message: string | UIElement) { + super(undefined); + this.message = Translations.W(message); + this.imageUrl = imageUrl; + + } + + InnerRender(): string { + return new Combine([ + '', + ``, + this.message, + '' + ]).Render(); + } + + +} \ No newline at end of file diff --git a/UI/MoreScreen.ts b/UI/MoreScreen.ts index 81d6ad0..b7018b7 100644 --- a/UI/MoreScreen.ts +++ b/UI/MoreScreen.ts @@ -7,6 +7,8 @@ import {Utils} from "../Utils"; import {link} from "fs"; import {UIEventSource} from "./UIEventSource"; import {VariableUiElement} from "./Base/VariableUIElement"; +import Combine from "./Base/Combine"; +import {SubtleButton} from "./Base/SubtleButton"; export class MoreScreen extends UIElement { @@ -23,26 +25,27 @@ export class MoreScreen extends UIElement { const els: UIElement[] = [] for (const k in AllKnownLayouts.allSets) { const layout = AllKnownLayouts.allSets[k] - if(layout.hideFromOverview){continue} + if (layout.hideFromOverview) { + continue + } const linkText = - `https://pietervdvn.github.io/MapComplete/${layout.name}.html?z=${this.currentLocation.data.zoom}&lat=${this.currentLocation.data.lat}&lon=${this.currentLocation.data.lon} - ` - const link = new FixedUiElement( - ` - - - -
${Utils.Upper(layout.name)}
- ${Translations.W(layout.description).Render()}
-
-
-` - ); + `https://pietervdvn.github.io/MapComplete/${layout.name}.html?z=${this.currentLocation.data.zoom}&lat=${this.currentLocation.data.lat}&lon=${this.currentLocation.data.lon}` + const link = + new SubtleButton(layout.icon, + new Combine([ + ``, + "
", + "", + Translations.W(layout.title), + "", + "
", + Translations.W(layout.description), + "
", + "
" + ])); els.push(link) - - } diff --git a/assets/pop-out.svg b/assets/pop-out.svg new file mode 100644 index 0000000..6a4cad6 --- /dev/null +++ b/assets/pop-out.svg @@ -0,0 +1,7 @@ + + + + + Svg Vector Icons : http://www.onlinewebfonts.com/icon + + \ No newline at end of file diff --git a/index.css b/index.css index dfdc93d..57f8d4e 100644 --- a/index.css +++ b/index.css @@ -4,6 +4,11 @@ html, body { padding: 0; } +a { + text-decoration: unset; + color:unset; +} + body { font-family: 'Helvetica Neue', Arial, sans-serif; } @@ -1187,7 +1192,7 @@ form { /** Switch layout **/ -.switch-layout a{ +.subtle-button{ display: flex; flex-wrap: nowrap; flex-direction: row; @@ -1201,7 +1206,7 @@ form { } -.switch-layout a img{ +.subtle-button img{ width: 3em; max-height: 3em; margin-right: 0.5em; diff --git a/index.ts b/index.ts index ac9fc58..4af80da 100644 --- a/index.ts +++ b/index.ts @@ -320,8 +320,9 @@ InitUiElements.OnlyIf(featureSwitchWelcomeMessage, () => { InitUiElements.InitWelcomeMessage(layoutToUse, osmConnection, bm, fullScreenMessage) }); -if (window != window.top || featureSwitchIframe.data !== "false") { - new FixedUiElement(``).AttachTo("top-right") +if ((window != window.top && featureSwitchWelcomeMessage.data === "false") || featureSwitchIframe.data !== "false") { + console.log("WELCOME? ",featureSwitchWelcomeMessage.data) + new FixedUiElement(``).AttachTo("top-right") }