@@ -12,74 +12,51 @@ export default {
1212 },
1313 methods: {
1414 setupPost (h ) {
15- return h (
16- ' div' , {
17- class: ' post' ,
18- },
19- [
20- h (' div' , {
21- class: ' d-flex align-items-center' ,
22- },
23- [
24- h (Avatar, {
25- props: {
26- size: ' 40' ,
27- text: this .post .Author ,
28- },
29- class: ' mr-3' ,
30- }),
31- h (' h4' , this .post .Title ),
32- ]),
33- h (' div' , {
34- class: ' d-flex align-items-center post-summary pb-2 mb-2' ,
35- },
36- [
37- h (' i' , {
38- class: ' material-icons mr-1' ,
39- },
40- ' thumb_up_alt'
41- ),
42- this .post .Likes ,
43- h (' i' , {
44- class: ' material-icons ml-2 mr-1' ,
45- },
46- ' comment'
47- ),
48- this .post .Comments ? this .post .Comments .length : 0 ,
49- ]),
50- this .post .Comments ? h (' a' , {
51- on: {
52- click : () => {
53- this .viewComments (this .post );
54- },
55- },
56- class: {
57- ' mt-2' : ! this .post .Comments [0 ].expanded ,
58- ' d-none' : this .post .Comments [0 ].expanded ,
15+ return h (' div' , { class: ' post' }, [
16+ h (' div' , { class: ' d-flex align-items-center' }, [
17+ h (Avatar, {
18+ props: {
19+ size: ' 40' ,
20+ text: this .post .Author ,
5921 },
22+ class: ' mr-3' ,
23+ }), h (' h4' , this .post .Title )]
24+ ),
25+ h (' div' , { class: ' d-flex align-items-center post-summary pb-2 mb-2' }, [
26+ h (' i' , { class: ' material-icons mr-1' }, ' thumb_up_alt' ),
27+ this .post .Likes ,
28+ h (' i' , { class: ' material-icons ml-2 mr-1' }, ' comment' ),
29+ this .post .Comments ? this .post .Comments .length : 0 ]
30+ ),
31+ this .post .Comments ? h (' a' , {
32+ on: {
33+ click : () => {
34+ this .viewComments (this .post );
35+ }
36+ },
37+ class: {
38+ ' mt-2' : ! this .post .Comments [0 ].expanded ,
39+ ' d-none' : this .post .Comments [0 ].expanded ,
6040 },
61- ' View Comments:' ) : null ,
62- this .setupComment (h, this .post , 0 ),
63- ]
64- );
41+ }, ' View Comments:' ) : null ,
42+ this .setupComments (h, this .post , 0 ),
43+ ]);
6544 },
66- setupComment (h , parent , counter ) {
45+ setupComments (h , parent , counter ) {
6746 if (parent .Comments ) {
68- return h (
69- ' div' ,
70- parent .Comments .map ((c , key ) => {
71- return [
72- h (Comment , {
73- key,
74- props: {
75- comment: c,
76- counter,
77- viewComments: this .viewComments ,
78- },
79- }),
80- this .setupComment (h, c, counter + 1 ),
81- ];
82- })
47+ return h (' div' , parent .Comments .map ((c , key ) => {
48+ return [
49+ h (Comment , {
50+ key,
51+ props: {
52+ comment: c,
53+ counter,
54+ viewComments: this .viewComments ,
55+ },
56+ }),
57+ this .setupComments (h, c, counter + 1 ),
58+ ];
59+ })
8360 );
8461 } else {
8562 return null ;
0 commit comments