diff --git a/app/assets/javascripts/discourse/app/components/discourse-banner.js b/app/assets/javascripts/discourse/app/components/discourse-banner.js index 738211dde2e..3060d3b65c1 100644 --- a/app/assets/javascripts/discourse/app/components/discourse-banner.js +++ b/app/assets/javascripts/discourse/app/components/discourse-banner.js @@ -1,15 +1,18 @@ import Component from "@ember/component"; import discourseComputed from "discourse-common/utils/decorators"; +import { action } from "@ember/object"; export default Component.extend({ hide: false, @discourseComputed("banner.html") content(bannerHtml) { - const $div = $("
"); - $div.append(bannerHtml); - $div.find("[id^='heading--']").removeAttr("id"); - return $div.html(); + const newDiv = document.createElement("div"); + newDiv.innerHTML = bannerHtml; + newDiv.querySelectorAll("[id^='heading--']").forEach((el) => { + el.removeAttribute("id"); + }); + return newDiv.innerHTML; }, @discourseComputed("user.dismissed_banner_key", "banner.key", "hide") @@ -27,17 +30,16 @@ export default Component.extend({ return !hide && bannerKey && dismissedBannerKey !== bannerKey; }, - actions: { - dismiss() { - if (this.user) { - this.user.dismissBanner(this.get("banner.key")); - } else { - this.set("hide", true); - this.keyValueStore.set({ - key: "dismissed_banner_key", - value: this.get("banner.key"), - }); - } - }, + @action + dismiss() { + if (this.user) { + this.user.dismissBanner(this.get("banner.key")); + } else { + this.set("hide", true); + this.keyValueStore.set({ + key: "dismissed_banner_key", + value: this.get("banner.key"), + }); + } }, }); diff --git a/app/assets/javascripts/discourse/app/templates/components/discourse-banner.hbs b/app/assets/javascripts/discourse/app/templates/components/discourse-banner.hbs index dc074862b6a..f9f2fb55c50 100644 --- a/app/assets/javascripts/discourse/app/templates/components/discourse-banner.hbs +++ b/app/assets/javascripts/discourse/app/templates/components/discourse-banner.hbs @@ -1,12 +1,20 @@ {{#if visible}}
diff --git a/app/assets/stylesheets/common/components/banner.scss b/app/assets/stylesheets/common/components/banner.scss index fc47c4ee456..2788f416558 100644 --- a/app/assets/stylesheets/common/components/banner.scss +++ b/app/assets/stylesheets/common/components/banner.scss @@ -3,29 +3,37 @@ // -------------------------------------------------- #banner { - padding: 0.5em 1em; + padding: 1em; background: var(--tertiary-low); color: var(--primary); z-index: z("base") + 1; margin-bottom: 1em; - max-height: 250px; + max-height: 20vh; overflow: auto; - &.overlay { - position: fixed; - } - - .close { - color: var(--primary-low-mid); - padding-left: 5px; + .floated-buttons { float: right; - .d-icon { - color: var(--primary-medium); - } - } + display: flex; - .meta { - display: none; + > .btn { + padding-top: 0em; + padding-bottom: 0em; + color: var(--primary-high); + .d-icon { + color: var(--primary-medium); + } + + &:hover { + color: var(--primary); + .d-icon { + color: var(--primary-high); + } + } + } + + .desktop-view & .btn.close { + margin-left: 0.25em; + } } } @@ -33,4 +41,12 @@ hr { border-color: var(--primary-medium); } + + > p:first-child { + margin-top: 0; + } + + > p:last-of-type { + margin-bottom: 0; + } } diff --git a/app/assets/stylesheets/mobile/components/_index.scss b/app/assets/stylesheets/mobile/components/_index.scss index 5f1e9142564..89eb683655c 100644 --- a/app/assets/stylesheets/mobile/components/_index.scss +++ b/app/assets/stylesheets/mobile/components/_index.scss @@ -1,4 +1,3 @@ -@import "banner"; @import "topic-footer-mobile-dropdown"; @import "user-card"; @import "user-stream-item"; diff --git a/app/assets/stylesheets/mobile/components/banner.scss b/app/assets/stylesheets/mobile/components/banner.scss deleted file mode 100644 index fc308f05880..00000000000 --- a/app/assets/stylesheets/mobile/components/banner.scss +++ /dev/null @@ -1,8 +0,0 @@ -// -------------------------------------------------- -// Banner -// -------------------------------------------------- - -#banner { - max-height: 180px; - height: 20vh; -} diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml index 2ae922540b7..78000b1a10e 100644 --- a/config/locales/client.en.yml +++ b/config/locales/client.en.yml @@ -411,8 +411,8 @@ en: switch_from_anon: "Exit Anonymous Mode" banner: - close: "Dismiss this banner." - edit: "Edit this banner >>" + close: "Dismiss this banner" + edit: "Edit" pwa: install_banner: "Do you want to install %{title} on this device?"