diff --git a/BeReal.xcodeproj/project.pbxproj b/BeReal.xcodeproj/project.pbxproj index c9f7f8b..dbb11e5 100644 --- a/BeReal.xcodeproj/project.pbxproj +++ b/BeReal.xcodeproj/project.pbxproj @@ -14,6 +14,7 @@ 02AE650029363DC1005A4AF3 /* BeRealTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 02AE64FF29363DC1005A4AF3 /* BeRealTests.swift */; }; 02AE650A29363DC1005A4AF3 /* BeRealUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 02AE650929363DC1005A4AF3 /* BeRealUITests.swift */; }; 02AE650C29363DC1005A4AF3 /* BeRealUITestsLaunchTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 02AE650B29363DC1005A4AF3 /* BeRealUITestsLaunchTests.swift */; }; + 02B334E8293A93DC00C45E31 /* FolderItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = 02B334E7293A93DC00C45E31 /* FolderItem.swift */; }; 02FFFD7B29395DD200306533 /* String+Constants.swift in Sources */ = {isa = PBXBuildFile; fileRef = 02FFFD7A29395DD200306533 /* String+Constants.swift */; }; 4694AAA0293A7C8800D54903 /* Modules in Frameworks */ = {isa = PBXBuildFile; productRef = 4694AA9F293A7C8800D54903 /* Modules */; }; /* End PBXBuildFile section */ @@ -47,6 +48,7 @@ 02AE650529363DC1005A4AF3 /* BeRealUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = BeRealUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 02AE650929363DC1005A4AF3 /* BeRealUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BeRealUITests.swift; sourceTree = ""; }; 02AE650B29363DC1005A4AF3 /* BeRealUITestsLaunchTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BeRealUITestsLaunchTests.swift; sourceTree = ""; }; + 02B334E7293A93DC00C45E31 /* FolderItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FolderItem.swift; sourceTree = ""; }; 02FFFD7A29395DD200306533 /* String+Constants.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "String+Constants.swift"; sourceTree = ""; }; /* End PBXFileReference section */ @@ -76,13 +78,6 @@ /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ - 027F60592937662300467238 /* Login */ = { - isa = PBXGroup; - children = ( - ); - path = Login; - sourceTree = ""; - }; 02AE64E229363DBF005A4AF3 = { isa = PBXGroup; children = ( @@ -108,8 +103,8 @@ 02AE64ED29363DBF005A4AF3 /* BeReal */ = { isa = PBXGroup; children = ( + 02B334E2293A908800C45E31 /* Browse */, 02FFFD7929395DBF00306533 /* Extensions */, - 027F60592937662300467238 /* Login */, 02AE64EE29363DBF005A4AF3 /* BeRealApp.swift */, 02AE64F029363DBF005A4AF3 /* ContentView.swift */, 02AE64F229363DC1005A4AF3 /* Assets.xcassets */, @@ -143,6 +138,30 @@ path = BeRealUITests; sourceTree = ""; }; + 02B334E2293A908800C45E31 /* Browse */ = { + isa = PBXGroup; + children = ( + 02B334E6293A93CE00C45E31 /* Components */, + 02B334E5293A93C400C45E31 /* Views */, + ); + path = Browse; + sourceTree = ""; + }; + 02B334E5293A93C400C45E31 /* Views */ = { + isa = PBXGroup; + children = ( + ); + path = Views; + sourceTree = ""; + }; + 02B334E6293A93CE00C45E31 /* Components */ = { + isa = PBXGroup; + children = ( + 02B334E7293A93DC00C45E31 /* FolderItem.swift */, + ); + path = Components; + sourceTree = ""; + }; 02FFFD7929395DBF00306533 /* Extensions */ = { isa = PBXGroup; children = ( @@ -292,6 +311,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + 02B334E8293A93DC00C45E31 /* FolderItem.swift in Sources */, 02AE64F129363DBF005A4AF3 /* ContentView.swift in Sources */, 02AE64EF29363DBF005A4AF3 /* BeRealApp.swift in Sources */, 02FFFD7B29395DD200306533 /* String+Constants.swift in Sources */, diff --git a/BeReal/Browse/Components/FolderItem.swift b/BeReal/Browse/Components/FolderItem.swift new file mode 100644 index 0000000..d712996 --- /dev/null +++ b/BeReal/Browse/Components/FolderItem.swift @@ -0,0 +1,74 @@ +// +// FolderItem.swift +// Browse +// +// Created by Javier Cicchelli on 02/12/2022. +// Copyright © 2022 Röck+Cöde. All rights reserved. +// + +import SwiftUI + +struct FolderItem: View { + + // MARK: Properties + + let name: String + + // MARK: Body + + var body: some View { + HStack(spacing: 16) { + Image.folder + .icon(size: 32) + .foregroundColor(.red) + + Text(name) + .font(.headline) + .foregroundColor(.primary) + .lineLimit(1) + .truncationMode(.middle) + .frame(maxWidth: .infinity, alignment: .leading) + + Image.chevronRight + .icon(size: 16) + .foregroundColor(.secondary) + .font(.headline) + } + .padding(16) + } + +} + +// MARK: - Image + +private extension Image { + + // MARK: Constants + + static let folder = Image(systemName: "folder.fill") + static let document = Image(systemName: "doc.fill") + static let chevronRight = Image(systemName: "chevron.right") + + // MARK: Functions + + func icon(size: CGFloat) -> some View { + self + .resizable() + .renderingMode(.template) + .scaledToFit() + .frame(width: size, height: size) + } + +} + +// MARK: - Previews + +struct BrowseItem_Previews: PreviewProvider { + static var previews: some View { + FolderItem(name: "Some folder name goes in here...") + .previewDisplayName("Browse item for folders") + + FolderItem(name: "Some very, extremely long folder name goes in here...") + .previewDisplayName("Browse item for folders with long name") + } +}