mirror of
https://github.com/Dimillian/IceCubesApp.git
synced 2024-11-26 18:21:00 +00:00
Poll results UI update (#233)
* Update constant to use CGFloat extension * Fill full width when 100% * Remove space
This commit is contained in:
parent
691b3f2667
commit
50bd01e8b4
2 changed files with 8 additions and 9 deletions
|
@ -6,4 +6,5 @@ public extension CGFloat {
|
||||||
static let statusColumnsSpacing: CGFloat = 8
|
static let statusColumnsSpacing: CGFloat = 8
|
||||||
static let maxColumnWidth: CGFloat = 650
|
static let maxColumnWidth: CGFloat = 650
|
||||||
static let sidebarWidth: CGFloat = 80
|
static let sidebarWidth: CGFloat = 80
|
||||||
|
static let pollBarHeight: CGFloat = 30
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,10 +5,6 @@ import Network
|
||||||
import SwiftUI
|
import SwiftUI
|
||||||
|
|
||||||
public struct StatusPollView: View {
|
public struct StatusPollView: View {
|
||||||
enum Constants {
|
|
||||||
static let barHeight: CGFloat = 30
|
|
||||||
}
|
|
||||||
|
|
||||||
@EnvironmentObject private var theme: Theme
|
@EnvironmentObject private var theme: Theme
|
||||||
@EnvironmentObject private var client: Client
|
@EnvironmentObject private var client: Client
|
||||||
@EnvironmentObject private var currentInstance: CurrentInstance
|
@EnvironmentObject private var currentInstance: CurrentInstance
|
||||||
|
@ -53,7 +49,7 @@ public struct StatusPollView: View {
|
||||||
makeBarView(for: option)
|
makeBarView(for: option)
|
||||||
if !viewModel.votes.isEmpty || viewModel.poll.expired || status.account.id == currentAccount.account?.id {
|
if !viewModel.votes.isEmpty || viewModel.poll.expired || status.account.id == currentAccount.account?.id {
|
||||||
Spacer()
|
Spacer()
|
||||||
Text("\(percentForOption(option: option)) %")
|
Text("\(percentForOption(option: option))%")
|
||||||
.font(.scaledSubheadline)
|
.font(.scaledSubheadline)
|
||||||
.frame(width: 40)
|
.frame(width: 40)
|
||||||
}
|
}
|
||||||
|
@ -110,14 +106,16 @@ public struct StatusPollView: View {
|
||||||
let width = widthForOption(option: option, proxy: proxy)
|
let width = widthForOption(option: option, proxy: proxy)
|
||||||
Rectangle()
|
Rectangle()
|
||||||
.foregroundColor(theme.tintColor)
|
.foregroundColor(theme.tintColor)
|
||||||
.frame(height: Constants.barHeight)
|
.frame(height: .pollBarHeight)
|
||||||
.frame(width: width)
|
.frame(width: width)
|
||||||
Spacer()
|
if width != proxy.size.width {
|
||||||
|
Spacer()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.foregroundColor(theme.tintColor.opacity(0.40))
|
.foregroundColor(theme.tintColor.opacity(0.40))
|
||||||
.frame(height: Constants.barHeight)
|
.frame(height: .pollBarHeight)
|
||||||
.clipShape(RoundedRectangle(cornerRadius: 8))
|
.clipShape(RoundedRectangle(cornerRadius: 8))
|
||||||
|
|
||||||
HStack {
|
HStack {
|
||||||
|
@ -133,7 +131,7 @@ public struct StatusPollView: View {
|
||||||
.padding(.leading, 12)
|
.padding(.leading, 12)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.frame(height: Constants.barHeight)
|
.frame(height: .pollBarHeight)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue