Skip to content

Commit

Permalink
Fixes #2609 - Add trophy icon next to the winning poll option (#2610)
Browse files Browse the repository at this point in the history
* Fixes #2609 - Add trophy icon next to the winning poll option

* Address PR comments
  • Loading branch information
stefanceriu authored Mar 27, 2024
1 parent 189d081 commit d72fa02
Show file tree
Hide file tree
Showing 9 changed files with 51 additions and 11 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"images" : [
{
"filename" : "poll-winner.svg",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"preserves-vector-representation" : true,
"template-rendering-intent" : "template"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions ElementX/Sources/Generated/Assets.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
// limitations under the License.
//

import Compound
import SwiftUI

struct PollOptionView: View {
Expand All @@ -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)
}
}
}

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions changelog.d/2609.change
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add trophy icon next to the winning poll option

0 comments on commit d72fa02

Please sign in to comment.