-
Notifications
You must be signed in to change notification settings - Fork 12
Zaid/show status dining detail view #489
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
| private var toolbarOpenClosedStatusView: some View { | ||
| let isOpen = diningHall.isOpen | ||
| let indicatorColor = (isOpen ? Color.green : Color.red).opacity(0.8) | ||
| return HStack(spacing: 8) { | ||
| Circle() | ||
| .fill(indicatorColor) | ||
| .frame(width: 8, height: 8) | ||
| Text(isOpen ? "Open" : "Closed") | ||
| .foregroundStyle(Color(BMColor.blackText)) | ||
| .font(Font(BMFont.light(12))) | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You shouldn't recreate this view from scratch as we already have something implemented in OpenClosedStatusView.swift. We should reuse the current implementation in OpenClosedStatusView.
On a second thought, I think something like this looks better as right now there's too much going on at the top with the text. The filled circle should communicate open and closed status perfectly in a much more succinct manner.
To accomplish this we can add an additional enum under OpenClosedStatusView.swift something like
enum Type {
case indicatorOnly
case indicatorAndText
}OpenClosedStatusView takes in an additional parameter of type OpenClosedStatusView.Type. var type: OpenClosedStatusView.Type
We can initialize with a default value to indicatorAndText like this: var type: OpenClosedStatusView.Type = .indicatorAndText
In the Haystack, we can do the following:
HStack(spacing: 10) {
switch type {
case .indicatorOnly:
indicatorView
case .indicatorAndText:
indicatorView
statusTextView
}
}and within the struct but outside var body, we can create private variables to refactor away the indicator and status text view implementations.
Shows status of each dining hall with an open/closed status.
