mirror of
https://github.com/flarum/framework.git
synced 2024-11-29 21:11:55 +08:00
fix tagLabel links (#96)
This commit is contained in:
parent
e787048af1
commit
c6829edd85
|
@ -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>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user