1
0
mirror of https://github.com/flarum/core.git synced 2025-08-08 01:16:52 +02:00

replace href and config with route on PostPreview (which is unused, also, update the component

This commit is contained in:
Alexander Skvortsov
2020-08-10 00:40:05 -04:00
committed by Franz Liedke
parent 8a0c241a8e
commit 16a6f82e8f

View File

@@ -7,18 +7,18 @@ import highlight from '../../common/helpers/highlight';
* The `PostPreview` component shows a link to a post containing the avatar and
* username of the author, and a short excerpt of the post's content.
*
* ### Props
* ### Attrs
*
* - `post`
*/
export default class PostPreview extends Component {
view() {
const post = this.props.post;
const post = this.attrs.post;
const user = post.user();
const excerpt = highlight(post.contentPlain(), this.props.highlight, 300);
const excerpt = highlight(post.contentPlain(), this.attrs.highlight, 300);
return (
<a className="PostPreview" href={app.route.post(post)} config={m.route} onclick={this.props.onclick}>
<a className="PostPreview" route={app.route.post(post)} onclick={this.attrs.onclick}>
<span className="PostPreview-content">
{avatar(user)}
{username(user)} <span className="PostPreview-excerpt">{excerpt}</span>