@@ -2,6 +2,7 @@ import app from '../app';
2
2
import Component from '../../common/Component' ;
3
3
import Button from '../../common/components/Button' ;
4
4
import type Mithril from 'mithril' ;
5
+ import ItemList from '../../common/utils/ItemList' ;
5
6
6
7
export interface IWelcomeHeroAttrs { }
7
8
@@ -24,25 +25,9 @@ export default class WelcomeHero extends Component<IWelcomeHeroAttrs> {
24
25
view ( vnode : Mithril . Vnode < IWelcomeHeroAttrs , this> ) {
25
26
if ( this . isHidden ( ) ) return null ;
26
27
27
- const slideUp = ( ) => {
28
- this . $ ( ) . slideUp ( this . hide . bind ( this ) ) ;
29
- } ;
30
-
31
28
return (
32
29
< header className = "Hero WelcomeHero" >
33
- < div className = "container" >
34
- < Button
35
- icon = "fas fa-times"
36
- onclick = { slideUp }
37
- className = "Hero-close Button Button--icon Button--link"
38
- aria-label = { app . translator . trans ( 'core.forum.welcome_hero.hide' ) }
39
- />
40
-
41
- < div className = "containerNarrow" >
42
- < h1 className = "Hero-title" > { app . forum . attribute ( 'welcomeTitle' ) } </ h1 >
43
- < div className = "Hero-subtitle" > { m . trust ( app . forum . attribute ( 'welcomeMessage' ) ) } </ div >
44
- </ div >
45
- </ div >
30
+ < div className = "container" > { this . viewItems ( ) . toArray ( ) } </ div >
46
31
</ header >
47
32
) ;
48
33
}
@@ -66,4 +51,37 @@ export default class WelcomeHero extends Component<IWelcomeHeroAttrs> {
66
51
67
52
return false ;
68
53
}
54
+
55
+ viewItems ( ) : ItemList < Mithril . Children > {
56
+ const items = new ItemList < Mithril . Children > ( ) ;
57
+
58
+ const slideUp = ( ) => {
59
+ this . $ ( ) . slideUp ( this . hide . bind ( this ) ) ;
60
+ } ;
61
+
62
+ items . add (
63
+ 'dismiss-button' ,
64
+ < Button
65
+ icon = "fas fa-times"
66
+ onclick = { slideUp }
67
+ className = "Hero-close Button Button--icon Button--link"
68
+ aria-label = { app . translator . trans ( 'core.forum.welcome_hero.hide' ) }
69
+ /> ,
70
+ 100
71
+ ) ;
72
+
73
+ items . add ( 'content' , < div className = "containerNarrow" > { this . contentItems ( ) . toArray ( ) } </ div > , 80 ) ;
74
+
75
+ return items ;
76
+ }
77
+
78
+ contentItems ( ) : ItemList < Mithril . Children > {
79
+ const items = new ItemList < Mithril . Children > ( ) ;
80
+
81
+ items . add ( 'title' , < h1 className = "Hero-title" > { app . forum . attribute ( 'welcomeTitle' ) } </ h1 > , 100 ) ;
82
+
83
+ items . add ( 'subtitle' , < div className = "Hero-subtitle" > { m . trust ( app . forum . attribute ( 'welcomeMessage' ) ) } </ div > ) ;
84
+
85
+ return items ;
86
+ }
69
87
}
0 commit comments