mirror of
https://github.com/flarum/core.git
synced 2025-08-01 14:10:37 +02:00
Massive JavaScript cleanup
- Use JSX for templates - Docblock/comment everything - Mostly passes ESLint (still some work to do) - Lots of renaming, refactoring, etc. CSS hasn't been updated yet.
This commit is contained in:
33
js/forum/src/components/ReplyPlaceholder.js
Normal file
33
js/forum/src/components/ReplyPlaceholder.js
Normal file
@@ -0,0 +1,33 @@
|
||||
import Component from 'flarum/Component';
|
||||
import avatar from 'flarum/helpers/avatar';
|
||||
import DiscussionControls from 'flarum/utils/DiscussionControls';
|
||||
|
||||
/**
|
||||
* The `ReplyPlaceholder` component displays a placeholder for a reply, which,
|
||||
* when clicked, opens the reply composer.
|
||||
*
|
||||
* ### Props
|
||||
*
|
||||
* - `discussion`
|
||||
*/
|
||||
export default class ReplyPlaceholder extends Component {
|
||||
view() {
|
||||
function triggerClick(e) {
|
||||
$(this).trigger('click');
|
||||
e.preventDefault();
|
||||
}
|
||||
|
||||
const reply = () => {
|
||||
DiscussionControls.replyAction.call(this.props.discussion, true);
|
||||
};
|
||||
|
||||
return (
|
||||
<article className="post reply-post" onclick={reply} onmousedown={triggerClick}>
|
||||
<header className="post-header">
|
||||
{avatar(app.session.user)}
|
||||
Write a Reply...
|
||||
</header>
|
||||
</article>
|
||||
);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user