Implemented the dismiss button in the ProfileView view for the Profile module.

This commit is contained in:
Javier Cicchelli 2022-12-12 21:30:16 +01:00
parent f324b59601
commit 3d50979d4b
2 changed files with 83 additions and 62 deletions

View File

@ -10,10 +10,9 @@
"profile.sections.names.label.first_name.text" = "First name";
"profile.sections.names.label.last_name.text" = "Last name";
"profile.sections.root_info.header.text" = "Root item information";
"profile.sections.root_info.header.text" = "Root folder";
"profile.sections.root_info.label.identifier.text" = "Identifier";
"profile.sections.root_info.label.is_directory.text" = "Is a directory?";
"profile.sections.root_info.label.last_modified.text" = "Last modified";
"profile.sections.root_info.label.name.text" = "Name";
"profile.sections.root_info.label.last_modified.text" = "Last modified";
"profile.button.log_out.text" = "Log out";

View File

@ -11,6 +11,10 @@ import SwiftUI
public struct ProfileView: View {
// MARK: Environments
@Environment(\.dismiss) private var dismiss
// MARK: Properties
private let user: User?
@ -32,6 +36,7 @@ public struct ProfileView: View {
// MARK: Body
public var body: some View {
ZStack {
ClearBackgroundList {
Section {
Image.photo
@ -94,6 +99,22 @@ public struct ProfileView: View {
.listRowBackground(Color.clear)
}
.background(Color.red)
VStack {
Button {
dismiss()
} label: {
Image.close
.resizable()
.frame(width: 32, height: 32)
.foregroundColor(.secondary)
}
Spacer()
}
.frame(maxWidth: .infinity, alignment: .trailing)
.padding([.top, .trailing], 24)
}
}
}
@ -101,6 +122,7 @@ public struct ProfileView: View {
// MARK: - Images+Constants
private extension Image {
static let close = Image(systemName: "xmark.circle.fill")
static let photo = Image(systemName: "person.crop.circle.fill")
}