@@ -17,13 +17,21 @@ struct CommentRow: View {
1717 viewModel. comment. name == " t1_id "
1818 }
1919
20- init ( comment: Comment ) {
20+ let isRoot : Bool
21+
22+ init ( comment: Comment , isRoot: Bool ) {
23+ self . isRoot = isRoot
2124 _viewModel = StateObject ( wrappedValue: CommentViewModel ( comment: comment) )
2225 }
2326
2427 var body : some View {
2528 HStack ( alignment: . top) {
26- CommentVoteView ( viewModel: viewModel) . padding ( . top, 4 )
29+ if !isRoot {
30+ Rectangle ( )
31+ . frame ( width: 1 )
32+ . background ( Color . white)
33+ . padding ( . bottom, 8 )
34+ }
2735 VStack ( alignment: . leading, spacing: 8 ) {
2836 HStack ( spacing: 0 ) {
2937 HStack ( spacing: 6 ) {
@@ -88,8 +96,11 @@ struct CommentRow: View {
8896 . font ( . footnote)
8997 . foregroundColor ( . gray)
9098 }
91- CommentActionsView ( viewModel: viewModel)
92- . foregroundColor ( . gray)
99+ HStack ( spacing: 16 ) {
100+ CommentVoteView ( viewModel: viewModel)
101+ CommentActionsView ( viewModel: viewModel)
102+ . foregroundColor ( . gray)
103+ }
93104 Divider ( )
94105 } . padding ( . vertical, 4 )
95106 }
@@ -99,10 +110,13 @@ struct CommentRow: View {
99110struct CommentRow_Previews : PreviewProvider {
100111 static var previews : some View {
101112 List {
102- CommentRow ( comment: static_comment)
103- CommentRow ( comment: static_comment)
104- CommentRow ( comment: static_comment)
105- CommentRow ( comment: static_comment)
113+ CommentRow ( comment: static_comment, isRoot: true )
114+ CommentRow ( comment: static_comment, isRoot: false )
115+ CommentRow ( comment: static_comment, isRoot: true )
116+ CommentRow ( comment: static_comment, isRoot: false )
117+ CommentRow ( comment: static_comment, isRoot: false )
118+ CommentRow ( comment: static_comment, isRoot: false )
106119 }
120+ . frame ( height: 800 )
107121 }
108122}
0 commit comments