Skip to content

Commit

Permalink
feat: xfn link component (#351)
Browse files Browse the repository at this point in the history
  • Loading branch information
NiclasNorin authored Nov 10, 2023
1 parent bc3609b commit 103a217
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 2 deletions.
5 changes: 5 additions & 0 deletions source/php/Component/Link/Link.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,10 @@ public function init()
if ($target) {
$this->data['attributeList']['target'] = $target;
}

//XFN
if ($xfn) {
$this->data['attributeList']['rel'] = $xfn;
}
}
}
6 changes: 4 additions & 2 deletions source/php/Component/Link/link.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,16 @@
"href": "",
"target": "_top",
"keepContent": true,
"keepWrapper": true
"keepWrapper": true,
"xfn": false
},
"description": {
"slot": "The content of the link",
"href": "Where should the link go to?",
"target": "Link target attribute. Default is _top. Allowed values are _blank, _self, _parent or _top.",
"keepContent": "If link is empty, should we show content anyways? Prints the content wrazpped by a span element.",
"keepWrapper": "If link is empty and keepContent is true, should we keep the span added by keepContent? If false, it will print the content without any wrapping element."
"keepWrapper": "If link is empty and keepContent is true, should we keep the span added by keepContent? If false, it will print the content without any wrapping element.",
"xfn": "Relation to the link (ex. nofollow)"
},
"view": "link.blade.php",
"dependency": {
Expand Down
1 change: 1 addition & 0 deletions source/php/Component/Nav/style/default.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
'id' => $id . '-' . $item['id'] . '-' . $loop->index . '__label',
'classList' => [$baseClass . '__link'],
'href' => $item['href'],
'xfn' => $item['xfn'] ?? false
])
@icon([
'icon' => $item['icon']['icon'] ?? null,
Expand Down
1 change: 1 addition & 0 deletions source/php/Component/Nav/style/tiles.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
'u-margin__bottom--1'
],
'href' => $item['href'],
'xfn' => $item['xfn'],
])
@icon($item['icon'])@endicon
<span class="{{$baseClass}}__text">{{$item['label']}}</span>
Expand Down

0 comments on commit 103a217

Please sign in to comment.