@@ -2,6 +2,8 @@ import Component from 'flarum/common/Component';
22import textContrastClass from 'flarum/common/helpers/textContrastClass' ;
33import tagIcon from '../../common/helpers/tagIcon' ;
44import classList from 'flarum/common/utils/classList' ;
5+ import ItemList from 'flarum/common/utils/ItemList' ;
6+ import Mithril from 'mithril' ;
57
68export default class TagHero extends Component {
79 view ( ) {
@@ -13,15 +15,39 @@ export default class TagHero extends Component {
1315 className = { classList ( 'Hero' , 'TagHero' , { 'TagHero--colored' : color , [ textContrastClass ( color ) ] : color } ) }
1416 style = { color ? { '--hero-bg' : color } : undefined }
1517 >
16- < div className = "container" >
17- < div className = "containerNarrow" >
18- < h1 className = "Hero-title" >
19- { tag . icon ( ) && tagIcon ( tag , { } , { useColor : false } ) } { tag . name ( ) }
20- </ h1 >
21- < div className = "Hero-subtitle" > { tag . description ( ) } </ div >
22- </ div >
23- </ div >
18+ < div className = "container" > { this . viewItems ( ) . toArray ( ) } </ div >
2419 </ header >
2520 ) ;
2621 }
22+
23+ /**
24+ * @returns {ItemList<Mithril.Children> }
25+ */
26+ viewItems ( ) {
27+ const items = new ItemList ( ) ;
28+
29+ items . add ( 'content' , < div className = "containerNarrow" > { this . contentItems ( ) . toArray ( ) } </ div > , 80 ) ;
30+
31+ return items ;
32+ }
33+
34+ /**
35+ * @returns {ItemList<Mithril.Children> }
36+ */
37+ contentItems ( ) {
38+ const items = new ItemList ( ) ;
39+ const tag = this . attrs . model ;
40+
41+ items . add (
42+ 'tag-title' ,
43+ < h1 className = "Hero-title" >
44+ { tag . icon ( ) && tagIcon ( tag , { } , { useColor : false } ) } { tag . name ( ) }
45+ </ h1 > ,
46+ 100
47+ ) ;
48+
49+ items . add ( 'tag-subtitle' , < div className = "Hero-subtitle" > { tag . description ( ) } </ div > , 90 ) ;
50+
51+ return items ;
52+ }
2753}
0 commit comments