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