// // ProfileView.swift // BeReal // // Created by Javier Cicchelli on 03/12/2022. // Copyright © 2022 Röck+Cöde. All rights reserved. // import SwiftUI public struct ProfileView: View { // MARK: Properties private let logOut: () -> Void // MARK: Initialisers public init(logOut: @escaping () -> Void) { self.logOut = logOut } // MARK: Body public var body: some View { ClearBackgroundList { Section { Image.photo .resizable() .scaledToFit() .frame(width: 160) .frame(maxWidth: .infinity) } .listRowBackground(Color.clear) Section { Label { Text("Javier") } icon: { Text( "profile.sections.names.label.first_name.text", bundle: .module, comment: "First name label text." ) } .labelStyle(.nameAndValue) Label { Text("Cicchelli") } icon: { Text( "profile.sections.names.label.last_name.text", bundle: .module, comment: "Last name label text." ) } .labelStyle(.nameAndValue) } header: { Text( "profile.sections.names.header.text", bundle: .module, comment: "Names section header text." ) } Section { Label { Text("71207ee4c0573fde80b03643caafe62731406404") } icon: { Text( "profile.sections.root_info.label.identifier.text", bundle: .module, comment: "Identifier label text." ) } .labelStyle(.nameAndValue) Label { Text("Yes") } icon: { Text( "profile.sections.root_info.label.is_directory.text", bundle: .module, comment: "Is directory label text." ) } .labelStyle(.nameAndValue) Label { Text("3 days ago") } icon: { Text( "profile.sections.root_info.label.last_modified.text", bundle: .module, comment: "Last modified label text." ) } .labelStyle(.nameAndValue) Label { Text("My files") } icon: { Text( "profile.sections.root_info.label.name.text", bundle: .module, comment: "Root name label text." ) } .labelStyle(.nameAndValue) } header: { Text( "profile.sections.root_info.header.text", bundle: .module, comment: "Root item information header text." ) } Section { Button { logOut() } label: { Text( "profile.button.log_out.text", bundle: .module, comment: "Log out button text." ) .fontWeight(.semibold) .foregroundColor(.primary) .frame(maxWidth: .infinity) } .tint(.orange) .buttonStyle(.borderedProminent) .buttonBorderShape(.roundedRectangle(radius: 8)) .controlSize(.large) } .listRowBackground(Color.clear) } .background(Color.red) } } // MARK: - Images+Constants private extension Image { static let photo = Image(systemName: "person.crop.circle.fill") } // MARK: - Previews struct ProfileView_Previews: PreviewProvider { static var previews: some View { ProfileView { // closure for log out action. } } }