Revert "DEV: Migrate custom header links to new objects setting type (#53)"

This reverts commit 73747938bd.
This commit is contained in:
OsamaSayegh
2024-04-25 01:56:51 +03:00
parent 73747938bd
commit a178fdd2f7
8 changed files with 32 additions and 204 deletions
@@ -12,13 +12,12 @@
>
{{#each this.links as |link|}}
<li
class={{concat-class
"headerLink"
link.device
link.locale
link.linkClass
link.hideOnScroll
}}
class="headerLink
{{link.device}}
{{link.keepOnScrollClass}}
{{link.locale}}
{{link.linkClass}}
{{link.keepOnScroll}}"
>
<a
title={{link.anchorAttributes.title}}
@@ -7,14 +7,16 @@ export default class CustomHeaderLinks extends Component {
}
get links() {
return settings.custom_header_links.reduce((result, link) => {
const linkText = link.text;
const linkTitle = link.title;
const linkHref = link.url;
const target = link.target;
const hideOnScroll = link.hide_on_scroll;
const locale = link.locale;
const device = link.view;
return settings.custom_header_links.split("|").reduce((result, item) => {
let [
linkText,
linkTitle,
linkHref,
device,
target = "",
keepOnScroll,
locale,
] = item.split(",").map((s) => s.trim());
if (!linkText || (locale && document.documentElement.lang !== locale)) {
return result;
@@ -30,8 +32,8 @@ export default class CustomHeaderLinks extends Component {
result.push({
device: `headerLink--${device}`,
hideOnScroll: `headerLink--${hideOnScroll}`,
locale: locale ? `headerLink--${locale}` : null,
keepOnScroll: `headerLink--${keepOnScroll}`,
locale: `headerLink--${locale}`,
linkClass,
anchorAttributes,
linkText,