mirror of
https://github.com/flarum/core.git
synced 2025-08-12 19:34:18 +02:00
Use Link component instead of route patch
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import Link from 'flarum/components/Link';
|
||||
import LinkButton from 'flarum/components/LinkButton';
|
||||
import classList from 'flarum/utils/classList';
|
||||
import tagIcon from '../../common/helpers/tagIcon';
|
||||
@@ -15,12 +16,12 @@ export default class TagLinkButton extends LinkButton {
|
||||
]);
|
||||
|
||||
return (
|
||||
<a className={className} route={this.attrs.route}
|
||||
<Link className={className} href={this.attrs.route}
|
||||
style={active && tag ? {color: tag.color()} : ''}
|
||||
title={description || ''}>
|
||||
{tagIcon(tag, {className: 'Button-icon'})}
|
||||
{tag ? tag.name() : app.translator.trans('flarum-tags.forum.index.untagged_link')}
|
||||
</a>
|
||||
</Link>
|
||||
);
|
||||
}
|
||||
|
||||
|
@@ -1,5 +1,6 @@
|
||||
import Page from 'flarum/components/Page';
|
||||
import IndexPage from 'flarum/components/IndexPage';
|
||||
import Link from 'flarum/components/Link';
|
||||
import listItems from 'flarum/helpers/listItems';
|
||||
import humanTime from 'flarum/helpers/humanTime';
|
||||
|
||||
@@ -36,29 +37,29 @@ export default class TagsPage extends Page {
|
||||
return (
|
||||
<li className={'TagTile ' + (tag.color() ? 'colored' : '')}
|
||||
style={{backgroundColor: tag.color()}}>
|
||||
<a className="TagTile-info" route={app.route.tag(tag)}>
|
||||
<Link className="TagTile-info" href={app.route.tag(tag)}>
|
||||
<h3 className="TagTile-name">{tag.name()}</h3>
|
||||
<p className="TagTile-description">{tag.description()}</p>
|
||||
{children
|
||||
? (
|
||||
<div className="TagTile-children">
|
||||
{children.map(child => [
|
||||
<a route={app.route.tag(child)}>
|
||||
<Link href={app.route.tag(child)}>
|
||||
{child.name()}
|
||||
</a>,
|
||||
</Link>,
|
||||
' '
|
||||
])}
|
||||
</div>
|
||||
) : ''}
|
||||
</a>
|
||||
</Link>
|
||||
{lastPostedDiscussion
|
||||
? (
|
||||
<a className="TagTile-lastPostedDiscussion"
|
||||
route={app.route.discussion(lastPostedDiscussion, lastPostedDiscussion.lastPostNumber())}
|
||||
<Link className="TagTile-lastPostedDiscussion"
|
||||
href={app.route.discussion(lastPostedDiscussion, lastPostedDiscussion.lastPostNumber())}
|
||||
>
|
||||
<span className="TagTile-lastPostedDiscussion-title">{lastPostedDiscussion.title()}</span>
|
||||
{humanTime(lastPostedDiscussion.lastPostedAt())}
|
||||
</a>
|
||||
</Link>
|
||||
) : (
|
||||
<span className="TagTile-lastPostedDiscussion"/>
|
||||
)}
|
||||
|
Reference in New Issue
Block a user