mirror of
https://github.com/flarum/core.git
synced 2025-10-14 00:15:51 +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:
46
js/forum/src/components/WelcomeHero.js
Normal file
46
js/forum/src/components/WelcomeHero.js
Normal file
@@ -0,0 +1,46 @@
|
||||
import Component from 'flarum/Component';
|
||||
import icon from 'flarum/helpers/icon';
|
||||
|
||||
/**
|
||||
* The `WelcomeHero` component displays a hero that welcomes the user to the
|
||||
* forum.
|
||||
*/
|
||||
export default class WelcomeHero extends Component {
|
||||
constructor(...args) {
|
||||
super(...args);
|
||||
|
||||
this.hidden = localStorage.getItem('welcomeHidden');
|
||||
}
|
||||
|
||||
view() {
|
||||
if (this.hidden) return <div/>;
|
||||
|
||||
const slideUp = () => {
|
||||
this.$().slideUp(this.hide.bind(this));
|
||||
};
|
||||
|
||||
return (
|
||||
<header className="hero welcome-hero">
|
||||
<div class="container">
|
||||
<button className="close btn btn-icon btn-link" onclick={slideUp}>
|
||||
{icon('times')}
|
||||
</button>
|
||||
|
||||
<div className="container-narrow">
|
||||
<h2>{app.forum.attribute('welcomeTitle')}</h2>
|
||||
<div className="subtitle">{m.trust(app.forum.attribute('welcomeMessage'))}</div>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Hide the welcome hero.
|
||||
*/
|
||||
hide() {
|
||||
localStorage.setItem('welcomeHidden', 'true');
|
||||
|
||||
this.hidden = true;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user