Fix existing Post component classes being dropped

This commit is contained in:
Daniël Klabbers 2019-11-12 20:25:58 +01:00
parent 607eeb530d
commit 0b3ce2e7d0

View File

@ -39,7 +39,7 @@ export default class Post extends Component {
view() {
const attrs = this.attrs();
attrs.className = this.classes().join(' ');
attrs.className = this.classes(attrs.className).join(' ');
return (
<article {...attrs}>
@ -98,8 +98,14 @@ export default class Post extends Component {
return [];
}
classes() {
let classes = ['Post'];
/**
* Get the post's classes.
*
* @param string classes
* @returns {string[]}
*/
classes(existing) {
let classes = (existing || '').split(' ').concat(['Post']);
if (this.loading) {
classes.push('Post--loading');