generated from element-hq/.github
-
Notifications
You must be signed in to change notification settings - Fork 105
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5df1411
commit a8a93ec
Showing
2 changed files
with
58 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
ElementX/Sources/Screens/RoomScreen/View/TimelineItemStylerView.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
// | ||
// TimelineItemStyleView.swift | ||
// ElementX | ||
// | ||
// Created by Ismail on 21.06.2022. | ||
// Copyright © 2022 Element. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
import SwiftUI | ||
import Combine | ||
|
||
import Introspect | ||
|
||
struct TimelineItemStylerView<Content: View>: View { | ||
|
||
let timelineItem: EventBasedTimelineItemProtocol | ||
@ViewBuilder let content: () -> Content | ||
|
||
var body: some View { | ||
VStack(alignment: .trailing, spacing: 4) { | ||
content() | ||
Text(timelineItem.timestamp) | ||
.font(.caption2) | ||
} | ||
.padding(8) | ||
.clipped() | ||
.background(Color.element.system) | ||
.cornerRadius(8) | ||
} | ||
|
||
} | ||
|
||
struct TimelineItemStylerView_Previews: PreviewProvider { | ||
static var previews: some View { | ||
body.preferredColorScheme(.light) | ||
body.preferredColorScheme(.dark) | ||
} | ||
|
||
@ViewBuilder | ||
static var body: some View { | ||
TimelineItemStylerView(timelineItem: item1) { | ||
TextRoomTimelineView(timelineItem: item1) | ||
} | ||
} | ||
|
||
private static var item1: TextRoomTimelineItem { | ||
return TextRoomTimelineItem(id: UUID().uuidString, | ||
text: "Short loin ground round tongue hamburger, fatback salami shoulder. Beef turkey sausage kielbasa strip steak. Alcatra capicola pig tail pancetta chislic.", | ||
timestamp: "08:05", | ||
shouldShowSenderDetails: true, | ||
senderId: "Bob") | ||
} | ||
} |