Compound Fonts (#834)

* Use CompoundFonts in DesignKit (deprecate ElementFonts).

* Use compound fonts everywhere.

* Update Authentication snapshots.

* Update RoomMembersListScreen snapshots.

Delete unused snapshots.

* Fix tests.
This commit is contained in:
Doug
2023-04-25 16:42:06 +01:00
committed by GitHub
parent 8b36e0faa5
commit 5bb2ceedf4
100 changed files with 185 additions and 178 deletions
+2
View File
@@ -12,12 +12,14 @@ let package = Package(
.library(name: "DesignKit", targets: ["DesignKit"])
],
dependencies: [
.package(url: "https://github.com/vector-im/compound-ios.git", revision: "0b1c62f9a9efac3d9ac06c51531392d55057a0eb"),
.package(url: "https://github.com/vector-im/element-design-tokens.git", exact: "0.0.3"),
.package(url: "https://github.com/siteline/SwiftUI-Introspect.git", from: "0.1.4")
],
targets: [
.target(name: "DesignKit",
dependencies: [
.product(name: "Compound", package: "compound-ios"),
.product(name: "DesignTokens", package: "element-design-tokens"),
.product(name: "Introspect", package: "SwiftUI-Introspect")
],
@@ -14,6 +14,7 @@
// limitations under the License.
//
import Compound
import DesignTokens
import SwiftUI
@@ -55,7 +56,7 @@ public struct ElementActionButtonStyle: ButtonStyle {
.padding(.vertical, verticalPadding)
.frame(maxWidth: maxWidth)
.foregroundColor(fontColor)
.font(.element.bodyBold)
.font(.compound.bodyLGSemibold)
.background(Capsule()
.fill(color)
.opacity(backgroundOpacity(when: configuration.isPressed)))
@@ -35,7 +35,7 @@ public struct ElementCapsuleButtonStyle: ButtonStyle {
configuration.label
.padding(7)
.frame(maxWidth: .infinity)
.font(.element.headline)
.font(.compound.bodyLGSemibold)
.foregroundColor(fontColor)
.multilineTextAlignment(.center)
.background(background)
@@ -47,7 +47,7 @@ public struct ElementGhostButtonStyle: ButtonStyle {
.padding(.vertical, verticalPadding)
.frame(maxWidth: maxWidth)
.foregroundColor(color)
.font(.element.footnoteBold)
.font(.compound.bodySMSemibold)
.background(border)
.opacity(opacity(when: configuration.isPressed))
}
@@ -18,6 +18,7 @@ import SwiftUI
public extension Font {
/// The fonts used by Element as defined in https://www.figma.com/file/X4XTH9iS2KGJ2wFKDqkyed/Compound?node-id=1362%3A0
@available(*, deprecated, renamed: "compound")
static let element = ElementFonts(values: ElementBaseFonts())
}
@@ -18,6 +18,7 @@ import UIKit
public extension UIFont {
/// The fonts used by Element as defined in https://www.figma.com/file/X4XTH9iS2KGJ2wFKDqkyed/Compound?node-id=1362%3A0
@available(*, deprecated, message: "Not yet available in compound.")
@objc static let element = ElementUIFonts(values: ElementBaseFonts())
}
@@ -119,13 +119,13 @@ public struct ElementTextFieldStyle: TextFieldStyle {
return VStack(alignment: .leading, spacing: 8) {
labelText
.font(.element.footnote)
.font(.compound.bodySM)
.foregroundColor(labelColor)
.padding(.horizontal, 16)
configuration
.focused($isFocused)
.font(.element.callout)
.font(.compound.bodyLG)
.foregroundColor(textColor)
.accentColor(accentColor)
.padding(.leading, 16.0)
@@ -148,7 +148,7 @@ public struct ElementTextFieldStyle: TextFieldStyle {
footerText
.tint(.element.links)
.font(.element.caption1)
.font(.compound.bodyXS)
.foregroundColor(footerColor)
.padding(.horizontal, 16)
}