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 bdfcc17ace
commit d7a3fa18ca
9 changed files with 51 additions and 11 deletions

View File

@@ -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"
}
}

View File

@@ -0,0 +1,10 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<g clip-path="url(#clip0_382_83157)">
<path d="M12.6667 3.33333H11.3333V2.66667C11.3333 2.3 11.0333 2 10.6667 2H5.33333C4.96667 2 4.66667 2.3 4.66667 2.66667V3.33333H3.33333C2.6 3.33333 2 3.93333 2 4.66667V5.33333C2 7.03333 3.28 8.42 4.92667 8.62667C5.34667 9.62667 6.24667 10.38 7.33333 10.6V12.6667H5.33333C4.96667 12.6667 4.66667 12.9667 4.66667 13.3333C4.66667 13.7 4.96667 14 5.33333 14H10.6667C11.0333 14 11.3333 13.7 11.3333 13.3333C11.3333 12.9667 11.0333 12.6667 10.6667 12.6667H8.66667V10.6C9.75333 10.38 10.6533 9.62667 11.0733 8.62667C12.72 8.42 14 7.03333 14 5.33333V4.66667C14 3.93333 13.4 3.33333 12.6667 3.33333ZM3.33333 5.33333V4.66667H4.66667V7.21333C3.89333 6.93333 3.33333 6.2 3.33333 5.33333ZM12.6667 5.33333C12.6667 6.2 12.1067 6.93333 11.3333 7.21333V4.66667H12.6667V5.33333Z" fill="#0DBD8B"/>
</g>
<defs>
<clipPath id="clip0_382_83157">
<rect width="16" height="16" fill="white"/>
</clipPath>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 1.0 KiB

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")
}
}

View File

@@ -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)
}
}
}

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:d81cd655a0c738cad2b456efc640c37e9b65cd8692e6e8d3e543b12f904ae4d7
size 98899
oid sha256:8a5c9342e65f0c2bea1627e0c22c1a02184ea19741505df0b5b3b4504c29c300
size 99626

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:b77b83603ad4ca5b3083f5d12a322aaf47fe9a93ffd9fecbdbe157f9c8a14219
size 114513
oid sha256:14e52190430b1b052f4afbeaf215920113d08fef8664661b97bfa00436f286ba
size 115312

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:6645504124fe64a3374a117512540deddb07a2354a6a36df409c6f77764b5f42
size 56089
oid sha256:5147fe5f373d38125a6768b9d9f96988a25755d21c4a1eadc4ead76c6cddecba
size 56849

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:e03246347b59115c7ec2df9411bbc8eaf439cd24b5697e926783e2b69f313eb9
size 71551
oid sha256:102e94a24fd386047e2677d8e9c582bb9accf47b474d227717b77960bbc432a6
size 72110

1
changelog.d/2609.change Normal file
View File

@@ -0,0 +1 @@
Add trophy icon next to the winning poll option