Skip to content

Commit

Permalink
MOB-452 : add cta button to submit trades (#139)
Browse files Browse the repository at this point in the history
* bump 1.6.36 -> 1.6.38

* some ui

* add label accessory to platform input, split out input views into view models

* clean up

* add cta button

* hook up button and button states

* abacus?

* clean up

* add case handling for USER_MAX_ORDERS
  • Loading branch information
mike-dydx committed Aug 20, 2024
1 parent 7bebd99 commit 585e0aa
Show file tree
Hide file tree
Showing 6 changed files with 295 additions and 228 deletions.
31 changes: 22 additions & 9 deletions PlatformUI/PlatformUI/Components/Labels/InlineAlert.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,22 @@ public class InlineAlertViewModel: PlatformViewModel {
return vm
}()

private var title: AnyView? {
guard let titleText = config.title else { return nil }
return Text(titleText)
.themeColor(foreground: .textPrimary)
.themeFont(fontType: .plus, fontSize: .medium)
.wrappedInAnyView()
}

private var body: AnyView? {
guard let bodyText = config.body else { return nil }
return Text(bodyText)
.themeColor(foreground: .textPrimary)
.themeFont(fontType: .base, fontSize: .small)
.wrappedInAnyView()
}

public override func createView(parentStyle: ThemeStyle = ThemeStyle.defaultStyle, styleKey: String? = nil) -> PlatformView {
PlatformView(viewModel: self, parentStyle: parentStyle, styleKey: styleKey) { [weak self] style in
guard let self = self else { return AnyView(PlatformView.nilView) }
Expand All @@ -31,12 +47,9 @@ public class InlineAlertViewModel: PlatformViewModel {
.frame(width: 6)
HStack(spacing: 0) {
VStack(alignment: .leading) {
Text(config.title)
.themeColor(foreground: .textPrimary)
.themeFont(fontType: .plus, fontSize: .medium)
Text(config.body)
.themeColor(foreground: .textPrimary)
.themeFont(fontType: .base, fontSize: .small)
self.title
self.body

}
Spacer()
}
Expand All @@ -53,11 +66,11 @@ public class InlineAlertViewModel: PlatformViewModel {

public extension InlineAlertViewModel {
struct Config {
public var title: String
public var body: String
public var title: String?
public var body: String?
public var level: Level

public init(title: String, body: String, level: Level) {
public init(title: String?, body: String?, level: Level) {
self.title = title
self.body = body
self.level = level
Expand Down
Loading

0 comments on commit 585e0aa

Please sign in to comment.