-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
673b748
commit a70ce1d
Showing
16 changed files
with
489 additions
and
65 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
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
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
70 changes: 70 additions & 0 deletions
70
AuthenticatorShared/UI/Platform/Application/Views/SearchNoResultsView.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,70 @@ | ||
import SwiftUI | ||
|
||
// MARK: - SearchNoResultsView | ||
|
||
/// A view that displays the no search results image and text. | ||
/// | ||
struct SearchNoResultsView<Content: View>: View { | ||
// MARK: Properties | ||
|
||
/// An optional view to display at the top of the scroll view above the no results image and text. | ||
var headerView: Content? | ||
|
||
// MARK: View | ||
|
||
var body: some View { | ||
GeometryReader { reader in | ||
ScrollView { | ||
VStack(spacing: 0) { | ||
if let headerView { | ||
headerView | ||
} | ||
|
||
VStack(spacing: 35) { | ||
Image(decorative: Asset.Images.magnifyingGlass) | ||
.resizable() | ||
.frame(width: 74, height: 74) | ||
.foregroundColor(Asset.Colors.textSecondary.swiftUIColor) | ||
|
||
Text(Localizations.thereAreNoItemsThatMatchTheSearch) | ||
.multilineTextAlignment(.center) | ||
.styleGuide(.callout) | ||
.foregroundColor(Asset.Colors.textPrimary.swiftUIColor) | ||
} | ||
.accessibilityIdentifier("NoSearchResultsLabel") | ||
.frame(maxWidth: .infinity, minHeight: reader.size.height, maxHeight: .infinity) | ||
} | ||
} | ||
} | ||
.background(Color(asset: Asset.Colors.backgroundSecondary)) | ||
} | ||
|
||
// MARK: Initialization | ||
|
||
/// Initialize a `SearchNoResultsView`. | ||
/// | ||
init() where Content == EmptyView { | ||
headerView = nil | ||
} | ||
|
||
/// Initialize a `SearchNoResultsView` with a header view. | ||
/// | ||
/// - Parameter headerView: An optional view to display at the top of the scroll view above the | ||
/// no results image and text. | ||
/// | ||
init(headerView: () -> Content) { | ||
self.headerView = headerView() | ||
} | ||
} | ||
|
||
// MARK: - Previews | ||
|
||
#Preview("No Results") { | ||
SearchNoResultsView() | ||
} | ||
|
||
#Preview("No Results With Header") { | ||
SearchNoResultsView { | ||
Text("Optional header text!") | ||
} | ||
} |
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
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
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
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
Oops, something went wrong.