1
0
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:
Toby Zerner
2015-07-15 14:00:11 +09:30
parent 4480e0a83f
commit ab6c03c0cc
220 changed files with 9785 additions and 5919 deletions

View 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;
}
}