fix tagLabel links (#96)

This commit is contained in:
Wadim Kalmykov 2020-10-05 22:52:11 +07:00 committed by GitHub
parent e787048af1
commit c6829edd85

View File

@ -1,4 +1,5 @@
import extract from 'flarum/utils/extract'; import extract from 'flarum/utils/extract';
import Link from 'flarum/components/Link';
import tagIcon from './tagIcon'; import tagIcon from './tagIcon';
export default function tagLabel(tag, attrs = {}) { export default function tagLabel(tag, attrs = {}) {
@ -17,14 +18,14 @@ export default function tagLabel(tag, attrs = {}) {
if (link) { if (link) {
attrs.title = tag.description() || ''; attrs.title = tag.description() || '';
attrs.route = app.route('tag', {tags: tag.slug()}); attrs.href = app.route('tag', {tags: tag.slug()});
} }
} else { } else {
attrs.className += ' untagged'; attrs.className += ' untagged';
} }
return ( return (
m((link ? 'a' : 'span'), attrs, m((link ? Link : 'span'), attrs,
<span className="TagLabel-text"> <span className="TagLabel-text">
{tag && tag.icon() && tagIcon(tag, {}, {useColor: false})} {tagText} {tag && tag.icon() && tagIcon(tag, {}, {useColor: false})} {tagText}
</span> </span>