Skip to content

Commit

Permalink
Add link target="" support to components that display menus. (#384)
Browse files Browse the repository at this point in the history
  • Loading branch information
alan-cole authored Aug 14, 2019
1 parent f6e7a5e commit 93e7d02
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 9 deletions.
6 changes: 4 additions & 2 deletions packages/components/Atoms/Global/mixins/parentlinks.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,15 @@ const parentlinks = {
return branch.map(item => {
let newitem = {
text: item.text,
url: item.url
url: item.url,
target: item.target
}
if (item.children) {
newitem.children = this.generateParentLinks(item.children)
newitem.children.unshift({
text: item.text,
url: item.url
url: item.url,
target: item.target
})
}
return newitem
Expand Down
2 changes: 1 addition & 1 deletion packages/components/Molecules/Sitemap/SitemapMenu.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<ul class="rpl-sitemap-menu__list" :class="'rpl-sitemap-menu__list--depth-' + depth">
<li class="rpl-sitemap-menu__list-item" v-for="(list, index) in menu" :key="index">
<rpl-link class="rpl-sitemap-menu__link" :class="'rpl-sitemap-menu__link--depth-' + depth" :href="list.url">{{ list.text }}</rpl-link>
<rpl-link class="rpl-sitemap-menu__link" :class="'rpl-sitemap-menu__link--depth-' + depth" :href="list.url" :target="list.target">{{ list.text }}</rpl-link>
<rpl-sitemap-menu v-if="list.children" :menu="list.children" :depth="depth + 1"></rpl-sitemap-menu>
</li>
</ul>
Expand Down
4 changes: 2 additions & 2 deletions packages/components/Organisms/SiteFooter/FooterNavigation.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
<template v-for="(item, index) in nav">
<li class="rpl-footer-nav__menu-item" :class="{'rpl-footer-nav__menu-item--parent': item.children}" :key="index" >
<h2 class="rpl-footer-nav__heading" @click="toggle(item, index, $event)">
<rpl-link :href="item.url">{{ item.text }}</rpl-link>
<rpl-link :href="item.url" :target="item.target">{{ item.text }}</rpl-link>
<rpl-icon :symbol="visibleItemIndex == index ? 'up' : 'down'" color="secondary" size="m" v-if="(minimize && item.children)" />
</h2>
<transition name="rpl-accordion">
<ul class="rpl-footer-nav__submenu-item" v-if="item.children" v-show="(!minimize || visibleItemIndex == index)">
<li v-for="(child, cIndex) in item.children" :key="cIndex">
<rpl-link :href="child.url">{{ child.text }}</rpl-link>
<rpl-link :href="child.url" :target="child.target">{{ child.text }}</rpl-link>
</li>
</ul>
</transition>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<div class="rpl-links-and-copyright">
<ul class="rpl-links-and-copyright__links">
<li v-for="(link, index) in links" :key="index">
<rpl-link :href="link.url">{{ link.text }}</rpl-link>
<rpl-link :href="link.url" :target="link.target">{{ link.text }}</rpl-link>
</li>
</ul>
<div class="rpl-links-and-copyright__copyright" v-html="copyright">
Expand Down
5 changes: 3 additions & 2 deletions packages/components/Organisms/SiteHeader/menu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<rpl-icon symbol="left" color="white" />
<span class="rpl-visually-hidden">Close {{ title }} and return to </span><span>{{ backTitle }}</span>
</button>
<rpl-link v-if="showMenuHeading && parent" class="rpl-menu__heading" :class="{ 'rpl-menu__heading--horizontal-sub' : (!isVerticalLayout && depth > 1) }" :href="parent.url">{{ parent.text }}</rpl-link>
<rpl-link v-if="showMenuHeading && parent" class="rpl-menu__heading" :class="{ 'rpl-menu__heading--horizontal-sub' : (!isVerticalLayout && depth > 1) }" :href="parent.url" :target="parent.target">{{ parent.text }}</rpl-link>
</div>
<ul class="rpl-menu__items" :class="{ 'rpl-menu__items--root': isRoot }">
<li
Expand All @@ -44,6 +44,7 @@
v-if="!list.children"
class="rpl-menu__item-link"
:href="list.url"
:target="list.target"
@focus="onItemFocus"
>
{{ list.text }}
Expand Down Expand Up @@ -533,7 +534,7 @@ export default {
.rpl-menu--vertical,
.rpl-menu--horizontal-floating-wrapper,
.rpl-menu--horizontal .rpl-menu--subs, {
.rpl-menu--horizontal .rpl-menu--subs {
.rpl-menu__item {
border-top: $rpl-menu-item-border;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<transition name="section" @enter="start" @after-enter="end" @before-leave="start" @after-leave="end">
<ul v-show="open" :data-depth="depth" class="rpl-section-menu">
<li v-for="(link, index) in menu" :key="index" class="rpl-section-menu__item rpl-section-menu__item--parent" :class="{'rpl-section-menu__item--active': menuItemOpen[index]}">
<rpl-link v-if="!link.children" :href="link.url" class="rpl-section-menu__item-link">{{ link.text }}</rpl-link>
<rpl-link v-if="!link.children" :href="link.url" :target="link.target" class="rpl-section-menu__item-link">{{ link.text }}</rpl-link>
<button
v-else
class="rpl-section-menu__item-link rpl-section-menu__item-link--parent"
Expand Down

0 comments on commit 93e7d02

Please sign in to comment.