Skip to content

Commit

Permalink
Poprawa działania linków (#112)
Browse files Browse the repository at this point in the history
* fix(ZLink): typo in link target

* feat(default layout): run `filterMenu` for submenus as well
  • Loading branch information
kovansky authored Oct 11, 2023
1 parent 418c082 commit 6b97dfa
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 7 deletions.
22 changes: 21 additions & 1 deletion packages/app/layouts/default.vue
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,27 @@ export default {
methods: {
filterMenu(menuLinks){
const parser = new UrlParser(this.$store);
return menuLinks.map((item)=> 'to' in item? {...item, to: parser.parse(item.to)}: item);
return menuLinks.map((item)=> {
let newItem = item
if ('to' in newItem) {
newItem = {
...item,
to: parser.parse(item.to)
}
} else {
newItem = item
}
if('submenu' in newItem) {
newItem.submenu = this.filterMenu(newItem.submenu)
}
if('mega_menu' in newItem) {
newItem.mega_menu = this.filterMenu(newItem.mega_menu)
}
return newItem
});
},
closeCookies () {
this.cookies = false
Expand Down
2 changes: 1 addition & 1 deletion packages/app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"@nuxtjs/google-analytics": "^2.4.0",
"@nuxtjs/pwa": "^3.3.5",
"@nuxtjs/sentry": "^5.0.3",
"@zhp-pl/ui": "^0.3.0",
"@zhp-pl/ui": "^0.3.1",
"body-scroll-lock": "^3.1.5",
"lodash.debounce": "^4.0.8",
"nuxt": "^2.15.6",
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@zhp-pl/ui",
"version": "0.3.0",
"version": "0.3.1",
"scripts": {
"create-index": "node scripts/create-index-file.js",
"version": "yarn create-index",
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/src/components/atoms/ZButton/ZButton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export default {
const { hack, tagComputed } = this;
switch (tagComputed) {
case 'a':
return { href: hack, target: '__blank' };
return { href: hack, target: '_blank' };
case 'router-link':
case 'nuxt-link':
return { to: hack };
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/src/components/atoms/ZLink/ZLink.vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export default {
const { tagComputed } = this;
switch (tagComputed) {
case 'a':
return { href: this.to, target: '__blank' };
return { href: this.to, target: '_blank' };
case 'router-link':
case 'nuxt-link':
return { to: this.to };
Expand Down
4 changes: 2 additions & 2 deletions yarn.lock
Git LFS file not shown

0 comments on commit 6b97dfa

Please sign in to comment.