Skip to content

Commit eadb30a

Browse files
authored
fix(ui): polish UI & fixes for small screens (#183)
1 parent 28a59aa commit eadb30a

37 files changed

+256
-199
lines changed

Bitkit/Assets.xcassets/Illustrations/app-icon.imageset/Contents.json renamed to Bitkit/Assets.xcassets/Illustrations/app-icon-black.imageset/Contents.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"images" : [
33
{
4-
"filename" : "app-icon.png",
4+
"filename" : "app-icon-black.png",
55
"idiom" : "universal",
66
"scale" : "1x"
77
},
15.1 KB
Loading
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"images" : [
3+
{
4+
"filename" : "app-icon-orange.png",
5+
"idiom" : "universal",
6+
"scale" : "1x"
7+
},
8+
{
9+
"idiom" : "universal",
10+
"scale" : "2x"
11+
},
12+
{
13+
"idiom" : "universal",
14+
"scale" : "3x"
15+
}
16+
],
17+
"info" : {
18+
"author" : "xcode",
19+
"version" : 1
20+
}
21+
}
23.4 KB
Loading
Binary file not shown.
296 Bytes
Binary file not shown.

Bitkit/Components/Button/Button.swift

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ struct CustomButton: View {
6464
let isDisabled: Bool
6565
let isLoading: Bool
6666
let shouldExpand: Bool
67+
let background: AnyView?
6768
let action: (() async -> Void)?
6869
let destination: AnyView?
6970

@@ -77,7 +78,8 @@ struct CustomButton: View {
7778
icon: (any View)? = nil,
7879
isDisabled: Bool = false,
7980
isLoading: Bool = false,
80-
shouldExpand: Bool = false
81+
shouldExpand: Bool = false,
82+
background: (any View)? = nil
8183
) {
8284
self.title = title
8385
self.variant = variant
@@ -86,6 +88,7 @@ struct CustomButton: View {
8688
self.isDisabled = isDisabled
8789
self.isLoading = isLoading
8890
self.shouldExpand = shouldExpand
91+
self.background = background.map { AnyView($0) }
8992
action = nil
9093
destination = nil
9194
}
@@ -99,6 +102,7 @@ struct CustomButton: View {
99102
isDisabled: Bool = false,
100103
isLoading: Bool = false,
101104
shouldExpand: Bool = false,
105+
background: (any View)? = nil,
102106
action: @escaping () async -> Void
103107
) {
104108
self.title = title
@@ -108,6 +112,7 @@ struct CustomButton: View {
108112
self.isDisabled = isDisabled
109113
self.isLoading = isLoading
110114
self.shouldExpand = shouldExpand
115+
self.background = background.map { AnyView($0) }
111116
self.action = action
112117
destination = nil
113118
}
@@ -121,6 +126,7 @@ struct CustomButton: View {
121126
isDisabled: Bool = false,
122127
isLoading: Bool = false,
123128
shouldExpand: Bool = false,
129+
background: (any View)? = nil,
124130
destination: some View
125131
) {
126132
self.title = title
@@ -130,6 +136,7 @@ struct CustomButton: View {
130136
self.isDisabled = isDisabled
131137
self.isLoading = isLoading
132138
self.shouldExpand = shouldExpand
139+
self.background = background.map { AnyView($0) }
133140
action = nil
134141
self.destination = AnyView(destination)
135142
}
@@ -144,7 +151,8 @@ struct CustomButton: View {
144151
isDisabled: isDisabled,
145152
isLoading: isLoading,
146153
isPressed: isPressed,
147-
shouldExpand: shouldExpand
154+
shouldExpand: shouldExpand,
155+
background: background
148156
))
149157
case .secondary:
150158
AnyView(SecondaryButtonView(

Bitkit/Components/Button/PrimaryButtonView.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ struct PrimaryButtonView: View {
88
let isLoading: Bool
99
let isPressed: Bool
1010
let shouldExpand: Bool
11+
let background: AnyView?
1112

1213
var body: some View {
1314
HStack(spacing: 8) {
@@ -38,9 +39,14 @@ struct PrimaryButtonView: View {
3839
}
3940

4041
private var backgroundGradient: some View {
42+
if let background {
43+
return background
44+
}
45+
4146
if isLoading {
4247
return AnyView(Color.gray6)
4348
}
49+
4450
if isDisabled {
4551
return AnyView(Color.clear)
4652
}

Bitkit/Components/CopyAddressCard.swift

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,10 @@ struct CopyAddressCard: View {
4949
onCopy(address: pair.address, index: index)
5050
}
5151

52-
ShareLink(item: URL(string: pair.address)!) {
52+
ShareLink(
53+
item: pair.address,
54+
preview: SharePreview(pair.address, image: Image("app-icon-orange"))
55+
) {
5356
CustomButton(
5457
title: t("common__share"),
5558
size: .small,
@@ -77,7 +80,8 @@ struct CopyAddressCard: View {
7780
Spacer()
7881
}
7982
.frame(maxWidth: .infinity, alignment: .leading)
80-
.padding(32)
83+
.padding(.vertical, 32)
84+
.padding(.horizontal, UIScreen.main.isSmall ? 16 : 32)
8185
.background(Color.black)
8286
.cornerRadius(8)
8387
.aspectRatio(1, contentMode: .fit)

Bitkit/Components/MoneyStack.swift

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ struct MoneyStack: View {
2525
symbol: true,
2626
color: .textSecondary
2727
)
28+
.contentTransition(.numericText())
2829
.transition(
2930
.move(edge: .bottom)
3031
.combined(with: .opacity)
@@ -40,6 +41,7 @@ struct MoneyStack: View {
4041
prefix: prefix,
4142
color: .textPrimary
4243
)
44+
.contentTransition(.numericText())
4345

4446
Spacer()
4547

@@ -60,6 +62,7 @@ struct MoneyStack: View {
6062
symbol: true,
6163
color: .textSecondary
6264
)
65+
.contentTransition(.numericText())
6366
.transition(
6467
.move(edge: .bottom)
6568
.combined(with: .opacity)
@@ -75,6 +78,7 @@ struct MoneyStack: View {
7578
prefix: prefix,
7679
color: .textPrimary
7780
)
81+
.contentTransition(.numericText())
7882

7983
Spacer()
8084

@@ -179,15 +183,20 @@ private extension MoneyStack {
179183
#Preview {
180184
ScrollView {
181185
VStack(alignment: .leading, spacing: 32) {
182-
// With toggle enabled
183-
MoneyStack(sats: 123_456, prefix: "+", showSymbol: false)
186+
// Large amounts to show dramatic transitions
187+
MoneyStack(sats: 1_234_567_890, prefix: "+", showSymbol: false)
184188
.environmentObject(MoneyStack.previewCurrencyVM(primaryDisplay: .bitcoin, currency: "USD"))
185189
.environmentObject(MoneyStack.previewSettingsVM())
186190

187-
// With symbol
188-
MoneyStack(sats: 123_456, prefix: "-", showSymbol: true)
191+
// With symbol and different amount
192+
MoneyStack(sats: 987_654_321, prefix: "-", showSymbol: true)
189193
.environmentObject(MoneyStack.previewCurrencyVM(primaryDisplay: .fiat, currency: "EUR"))
190194
.environmentObject(MoneyStack.previewSettingsVM())
195+
196+
// Medium amount with eye icon
197+
MoneyStack(sats: 456_789_123, showEyeIcon: true)
198+
.environmentObject(MoneyStack.previewCurrencyVM(primaryDisplay: .bitcoin, currency: "USD", displayUnit: .classic))
199+
.environmentObject(MoneyStack.previewSettingsVM(hideBalance: true))
191200
}
192201
.frame(maxWidth: .infinity, alignment: .leading)
193202
.padding()

0 commit comments

Comments
 (0)