Fixes #2609 - Add trophy icon next to the winning poll option (#2610)

* Fixes #2609 - Add trophy icon next to the winning poll option

* Address PR comments
This commit is contained in:
Stefan Ceriu
2024-03-27 10:50:32 +02:00
committed by GitHub
parent 189d081da0
commit d72fa02ac6
9 changed files with 51 additions and 11 deletions
+1
View File
@@ -43,6 +43,7 @@ internal enum Asset {
internal static let mediaPause = ImageAsset(name: "images/media-pause")
internal static let mediaPlay = ImageAsset(name: "images/media-play")
internal static let notificationsPromptGraphic = ImageAsset(name: "images/notifications-prompt-graphic")
internal static let pollWinner = ImageAsset(name: "images/poll-winner")
internal static let waitingGradient = ImageAsset(name: "images/waiting-gradient")
}
}
@@ -14,6 +14,7 @@
// limitations under the License.
//
import Compound
import SwiftUI
struct PollOptionView: View {
@@ -39,9 +40,20 @@ struct PollOptionView: View {
.frame(maxWidth: .infinity, alignment: .leading)
if showVotes {
Text(L10n.commonPollVotesCount(pollOption.votes))
.font(isFinalWinningOption ? .compound.bodySMSemibold : .compound.bodySM)
.foregroundColor(isFinalWinningOption ? .compound.textPrimary : .compound.textSecondary)
if isFinalWinningOption {
HStack(spacing: 4) {
CompoundIcon(asset: Asset.Images.pollWinner)
.foregroundColor(.compound.iconAccentTertiary)
Text(L10n.commonPollVotesCount(pollOption.votes))
.font(.compound.bodySMSemibold)
.foregroundColor(.compound.textPrimary)
}
} else {
Text(L10n.commonPollVotesCount(pollOption.votes))
.font(.compound.bodySM)
.foregroundColor(.compound.textSecondary)
}
}
}