mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-02 11:47:51 +00:00
new pill view color and size (#1933)
This commit is contained in:
@@ -6460,7 +6460,7 @@
|
||||
repositoryURL = "https://github.com/vector-im/compound-ios";
|
||||
requirement = {
|
||||
kind = revision;
|
||||
revision = d6938dde5b345e5e7a8dea06a0481adaa5246327;
|
||||
revision = 01b71e45542a73cb2dd8d5e56d289abff68fe715;
|
||||
};
|
||||
};
|
||||
9A472EE0218FE7DCF5283429 /* XCRemoteSwiftPackageReference "SwiftUI-Introspect" */ = {
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
"kind" : "remoteSourceControl",
|
||||
"location" : "https://github.com/vector-im/compound-ios",
|
||||
"state" : {
|
||||
"revision" : "d6938dde5b345e5e7a8dea06a0481adaa5246327"
|
||||
"revision" : "01b71e45542a73cb2dd8d5e56d289abff68fe715"
|
||||
}
|
||||
},
|
||||
{
|
||||
|
||||
@@ -21,19 +21,27 @@ struct PillView: View {
|
||||
@ObservedObject var context: PillContext
|
||||
/// callback triggerd by changes in the display text
|
||||
let didChangeText: () -> Void
|
||||
|
||||
var textColor: Color {
|
||||
context.viewState.isOwnMention ? .compound.textOnSolidPrimary : .compound.textSuccessPrimary
|
||||
}
|
||||
|
||||
var backgroundColor: Color {
|
||||
context.viewState.isOwnMention ? .compound._bgOwnPill : .compound._bgPill
|
||||
}
|
||||
|
||||
var body: some View {
|
||||
HStack(spacing: 4) {
|
||||
LoadableAvatarImage(url: context.viewState.avatarURL, name: context.viewState.name, contentID: context.viewState.contentID, avatarSize: .custom(24), imageProvider: imageProvider)
|
||||
HStack(spacing: 2) {
|
||||
LoadableAvatarImage(url: context.viewState.avatarURL, name: context.viewState.name, contentID: context.viewState.contentID, avatarSize: .custom(16), imageProvider: imageProvider)
|
||||
Text(context.viewState.displayText)
|
||||
.font(.compound.bodyLGSemibold)
|
||||
.foregroundColor(.compound.textOnSolidPrimary)
|
||||
.foregroundColor(textColor)
|
||||
.lineLimit(1)
|
||||
}
|
||||
.padding(.horizontal, 8)
|
||||
.padding(.vertical, 4)
|
||||
// for now design has defined no color so we will just use gray
|
||||
.background(Capsule().foregroundColor(context.viewState.isOwnMention ? .compound.bgCriticalPrimary : .gray))
|
||||
.padding(.leading, 4)
|
||||
.padding(.trailing, 6)
|
||||
.padding(.vertical, 1)
|
||||
.background { Capsule().foregroundColor(backgroundColor) }
|
||||
.frame(maxWidth: PillConstants.maxWidth)
|
||||
.onChange(of: context.viewState.displayText) { _ in
|
||||
didChangeText()
|
||||
@@ -53,11 +61,9 @@ struct PillView_Previews: PreviewProvider, TestablePreview {
|
||||
.previewDisplayName("Loading Own")
|
||||
PillView(imageProvider: mockMediaProvider,
|
||||
context: PillContext.mock(type: .loadedUser(isOwn: false))) { }
|
||||
// To simulate the trimming that happens at UIKit level
|
||||
.previewDisplayName("Loaded Long")
|
||||
PillView(imageProvider: mockMediaProvider,
|
||||
context: PillContext.mock(type: .loadedUser(isOwn: true))) { }
|
||||
// To simulate the trimming that happens at UIKit level
|
||||
.previewDisplayName("Loaded Long Own")
|
||||
PillView(imageProvider: mockMediaProvider,
|
||||
context: PillContext.mock(type: .allUsers)) { }
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:7757fa407df9869e19ef6d59c487e0ce8fb848fbb0f864ec328ecfc86bdc1834
|
||||
size 62544
|
||||
oid sha256:1a15ca8e95ef692687c5b1eede5d0bd6f7fff14b544100928dd409cd6a48d66d
|
||||
size 62925
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:424b4e9eb2c8a83401fec9d8c8c737c825a622e025c443563c4a23a17976ab1d
|
||||
size 62173
|
||||
oid sha256:e28c9283ff63ad76753b6ad671d996034c07e453e44345cbac176dcf4b433c73
|
||||
size 61442
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:c3cc84247a769c93950919a515079d0ff4a20293d9874df0905bcdf4264b78eb
|
||||
size 66498
|
||||
oid sha256:b78e02b2c47f049fa5e9c5802d76572696d497cd9a09cdb4a05edcb60b1da2df
|
||||
size 66669
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:b28152066f759f0fb99c4bfab9e51bb915a4f9d12c555c05063a00b13eec1476
|
||||
size 65700
|
||||
oid sha256:bd550435f2618862e8338704605a98f0471aa49a23425ccfbfc1487ad339279c
|
||||
size 66822
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:91680c015ee5ecbadadb799ff90f99a0112f00b7a95460d53bcd2d8f18177a1c
|
||||
size 64987
|
||||
oid sha256:9fd608f61a0055a49ad6b93a2db812c9a6fb60444a12699bffd78b05d61f3ee5
|
||||
size 63623
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:eb935eb860e241bf52bc2b1bd45acf8361f661666721b3d512b6f5afd432cf70
|
||||
size 64239
|
||||
oid sha256:ffe228e557bf1c029f5b07c6e187db1413cedae314747241c7c03cbcb291b240
|
||||
size 63702
|
||||
|
||||
+1
-1
@@ -49,7 +49,7 @@ packages:
|
||||
# path: ../matrix-rust-sdk
|
||||
Compound:
|
||||
url: https://github.com/vector-im/compound-ios
|
||||
revision: d6938dde5b345e5e7a8dea06a0481adaa5246327
|
||||
revision: 01b71e45542a73cb2dd8d5e56d289abff68fe715
|
||||
# path: ../compound-ios
|
||||
AnalyticsEvents:
|
||||
url: https://github.com/matrix-org/matrix-analytics-events
|
||||
|
||||
Reference in New Issue
Block a user