mirror of
https://github.com/flarum/framework.git
synced 2024-11-30 05:13:37 +08:00
Improved naming of class for post by actor.
Made class list for post extensible by using a separate method.
This commit is contained in:
parent
9f0a178f58
commit
830f48a212
|
@ -39,7 +39,7 @@ export default class Post extends Component {
|
|||
view() {
|
||||
const attrs = this.attrs();
|
||||
|
||||
attrs.className = 'Post ' + (this.loading ? 'Post--loading ' : '') + (this.props.post.user() === app.session.user ? 'Post--self' : '') + (attrs.className || '');
|
||||
attrs.className = this.classes().join(' ');
|
||||
|
||||
return (
|
||||
<article {...attrs}>
|
||||
|
@ -98,6 +98,20 @@ export default class Post extends Component {
|
|||
return [];
|
||||
}
|
||||
|
||||
classes() {
|
||||
let classes = ['Post'];
|
||||
|
||||
if (this.loading) {
|
||||
classes.push('Post--loading');
|
||||
}
|
||||
|
||||
if (this.props.post.user() === app.session.user) {
|
||||
classes.push('Post--by-actor');
|
||||
}
|
||||
|
||||
return classes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build an item list for the post's actions.
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue
Block a user