-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Domains Dashboard Card: Card UI v2 (#20570)
* Create a decorative search view for DomainDashboardCard - A placeholder view for a search bar that suggests searching a domain - A view adapts to light and dark mode and fades out - Accessibility is turned off since it serves the same purpose as an image * Integrate search view in DashboardDomainsCardCell * Fix typo with DashboardDomainsCardSearchView name
- Loading branch information
Showing
3 changed files
with
89 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
71 changes: 71 additions & 0 deletions
71
...lasses/ViewRelated/Blog/Blog Dashboard/Cards/Domains/DashboardDomainsCardSearchView.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
import SwiftUI | ||
|
||
struct DashboardDomainsCardSearchView: View { | ||
@SwiftUI.Environment(\.colorScheme) var colorScheme: ColorScheme | ||
|
||
var body: some View { | ||
VStack(alignment: .center) { | ||
HStack { | ||
Image(systemName: Constants.iconName) | ||
.foregroundColor(Colors.icon) | ||
.font(.system(size: Metrics.iconSize)) | ||
Text(Constants.searchBarPlaceholder) | ||
.foregroundColor(Colors.text) | ||
.font(.system(size: Metrics.fontSize)) | ||
Spacer() | ||
} | ||
.padding(.horizontal, Metrics.padding) | ||
.frame(height: Metrics.searchBarHeight) | ||
.background( | ||
RoundedRectangle(cornerRadius: Metrics.containerCornerRadius) | ||
.foregroundColor(Colors.containerBackground) | ||
) | ||
Spacer() | ||
RoundedRectangle(cornerRadius: Metrics.containerCornerRadius) | ||
.foregroundColor(Colors.containerBackground) | ||
} | ||
.padding([.leading, .trailing, .top], Metrics.padding) | ||
.frame(height: Metrics.height) | ||
.background( | ||
ZStack { | ||
LinearGradient( | ||
gradient: Gradient( | ||
colors: [ | ||
colorScheme == .light ? Colors.gradientTopLight : Colors.gradientTopDark, | ||
Color.clear | ||
] | ||
), | ||
startPoint: .top, | ||
endPoint: .bottom | ||
) | ||
} | ||
) | ||
.cornerRadius(Metrics.cornerRadius) | ||
.accessibilityHidden(true) | ||
} | ||
} | ||
|
||
private extension DashboardDomainsCardSearchView { | ||
enum Metrics { | ||
static let padding: CGFloat = 8 | ||
static let cornerRadius: CGFloat = 16 | ||
static let containerCornerRadius: CGFloat = 8 | ||
static let iconSize: CGFloat = 20 | ||
static let fontSize: CGFloat = 15 // fixed .footnote style size | ||
static let height: CGFloat = 110 | ||
static let searchBarHeight: CGFloat = 40 | ||
} | ||
|
||
enum Constants { | ||
static let iconName = "globe" | ||
static let searchBarPlaceholder = "domain.blog" | ||
} | ||
|
||
enum Colors { | ||
static let gradientTopLight = Color(UIColor.secondarySystemBackground) | ||
static let gradientTopDark = Color(UIColor.tertiarySystemBackground) | ||
static let containerBackground = Color(UIColor.secondarySystemGroupedBackground) | ||
static let icon = Color(UIColor.jetpackGreen) | ||
static let text = Color(UIColor.textSubtle) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters