mirror of
https://github.com/flarum/core.git
synced 2025-08-06 08:27:42 +02:00
feat: improve extensibility of WelcomeHero
(#4199)
This commit is contained in:
@@ -26,20 +26,43 @@ export default class WelcomeHero extends Component<IWelcomeHeroAttrs> {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<header className="Hero WelcomeHero">
|
<header className="Hero WelcomeHero">
|
||||||
<div className="container">
|
<div className="container">{this.viewItems().toArray()}</div>
|
||||||
<Button
|
|
||||||
icon="fas fa-times"
|
|
||||||
onclick={slideUp}
|
|
||||||
className="Hero-close Button Button--icon Button--link"
|
|
||||||
aria-label={app.translator.trans('core.forum.welcome_hero.hide')}
|
|
||||||
/>
|
|
||||||
|
|
||||||
<div className="containerNarrow">{this.welcomeItems().toArray()}</div>
|
|
||||||
</div>
|
|
||||||
</header>
|
</header>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
viewItems(): ItemList<Mithril.Children> {
|
||||||
|
const items = new ItemList<Mithril.Children>();
|
||||||
|
|
||||||
|
const slideUp = () => {
|
||||||
|
this.$().slideUp(this.hide.bind(this));
|
||||||
|
};
|
||||||
|
|
||||||
|
items.add(
|
||||||
|
'dismiss-button',
|
||||||
|
<Button
|
||||||
|
icon="fas fa-times"
|
||||||
|
onclick={slideUp}
|
||||||
|
className="Hero-close Button Button--icon Button--link"
|
||||||
|
aria-label={app.translator.trans('core.forum.welcome_hero.hide')}
|
||||||
|
/>,
|
||||||
|
100
|
||||||
|
);
|
||||||
|
|
||||||
|
items.add('content', <div className="containerNarrow">{this.contentItems().toArray()}</div>, 80);
|
||||||
|
|
||||||
|
return items;
|
||||||
|
}
|
||||||
|
|
||||||
|
contentItems(): ItemList<Mithril.Children> {
|
||||||
|
const items = new ItemList<Mithril.Children>();
|
||||||
|
|
||||||
|
items.add('title', <h1 className="Hero-title">{app.forum.attribute('welcomeTitle')}</h1>, 100);
|
||||||
|
items.add('subtitle', <div className="Hero-subtitle">{m.trust(app.forum.attribute('welcomeMessage'))}</div>);
|
||||||
|
|
||||||
|
return items;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Hide the welcome hero.
|
* Hide the welcome hero.
|
||||||
*/
|
*/
|
||||||
@@ -58,13 +81,4 @@ export default class WelcomeHero extends Component<IWelcomeHeroAttrs> {
|
|||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
welcomeItems(): ItemList<Mithril.Children> {
|
|
||||||
const items = new ItemList<Mithril.Children>();
|
|
||||||
|
|
||||||
items.add('hero-title', <h1 className="Hero-title">{app.forum.attribute('welcomeTitle')}</h1>, 20);
|
|
||||||
items.add('hero-subtitle', <div className="Hero-subtitle">{m.trust(app.forum.attribute('welcomeMessage'))}</div>, 10);
|
|
||||||
|
|
||||||
return items;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user