Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: 🎸 add new control ContactItem #307

Merged
merged 4 commits into from
Jul 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions Apps/Examples/Examples.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -135,13 +135,17 @@
B80DA9C2260D04FB00C0B2E9 /* SingleActionLongFollowButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = B80DA9C1260D04FB00C0B2E9 /* SingleActionLongFollowButton.swift */; };
B80DA9C62612A54E00C0B2E9 /* ActivationScreenSample.swift in Sources */ = {isa = PBXBuildFile; fileRef = B80DA9C42612A54E00C0B2E9 /* ActivationScreenSample.swift */; };
B80DA9C72612A54E00C0B2E9 /* WelcomeScreenSample.swift in Sources */ = {isa = PBXBuildFile; fileRef = B80DA9C52612A54E00C0B2E9 /* WelcomeScreenSample.swift */; };
B8101D52268BB84B00D32560 /* ContactItemTapStateExamples.swift in Sources */ = {isa = PBXBuildFile; fileRef = B8101D51268BB84B00D32560 /* ContactItemTapStateExamples.swift */; };
B8355ED525225A52001AB341 /* AreaChartSnapshotTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = B8355ED425225A52001AB341 /* AreaChartSnapshotTests.swift */; };
B8355ED725227D1B001AB341 /* StackedColumnChartSnapshotTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = B8355ED625227D1B001AB341 /* StackedColumnChartSnapshotTests.swift */; };
B8355ED925227E7E001AB341 /* BarChartSnapshotTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = B8355ED825227E7E001AB341 /* BarChartSnapshotTests.swift */; };
B8355EDB25227F05001AB341 /* StackedBarChartSnapshotTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = B8355EDA25227F05001AB341 /* StackedBarChartSnapshotTests.swift */; };
B8355EDD25227F87001AB341 /* BubbleChartSnapshotTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = B8355EDC25227F87001AB341 /* BubbleChartSnapshotTests.swift */; };
B8355EDF25227F9B001AB341 /* ScatterChartSnapshotTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = B8355EDE25227F9B001AB341 /* ScatterChartSnapshotTests.swift */; };
B8355EE12522846B001AB341 /* RealColumnChartSnapshotTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = B8355EE02522846B001AB341 /* RealColumnChartSnapshotTests.swift */; };
B846F94626815CC90085044B /* ContactItemExample.swift in Sources */ = {isa = PBXBuildFile; fileRef = B846F94526815CC90085044B /* ContactItemExample.swift */; };
B846F94826815DE50085044B /* ContactItemRegularExamples.swift in Sources */ = {isa = PBXBuildFile; fileRef = B846F94726815DE50085044B /* ContactItemRegularExamples.swift */; };
B846F94A26815DF30085044B /* ContactItemCompactExamples.swift in Sources */ = {isa = PBXBuildFile; fileRef = B846F94926815DF30085044B /* ContactItemCompactExamples.swift */; };
B84D24EC2652F343007F2373 /* ObjectHeaderSpecCompact.swift in Sources */ = {isa = PBXBuildFile; fileRef = B84D24E52652F343007F2373 /* ObjectHeaderSpecCompact.swift */; };
B84D24ED2652F343007F2373 /* HeaderChartExample.swift in Sources */ = {isa = PBXBuildFile; fileRef = B84D24E62652F343007F2373 /* HeaderChartExample.swift */; };
B84D24EE2652F343007F2373 /* ObjectHeaderViewScenarios.swift in Sources */ = {isa = PBXBuildFile; fileRef = B84D24E72652F343007F2373 /* ObjectHeaderViewScenarios.swift */; };
Expand Down Expand Up @@ -325,13 +329,17 @@
B80DA9C1260D04FB00C0B2E9 /* SingleActionLongFollowButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SingleActionLongFollowButton.swift; sourceTree = "<group>"; };
B80DA9C42612A54E00C0B2E9 /* ActivationScreenSample.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ActivationScreenSample.swift; sourceTree = "<group>"; };
B80DA9C52612A54E00C0B2E9 /* WelcomeScreenSample.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = WelcomeScreenSample.swift; sourceTree = "<group>"; };
B8101D51268BB84B00D32560 /* ContactItemTapStateExamples.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContactItemTapStateExamples.swift; sourceTree = "<group>"; };
B8355ED425225A52001AB341 /* AreaChartSnapshotTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AreaChartSnapshotTests.swift; sourceTree = "<group>"; };
B8355ED625227D1B001AB341 /* StackedColumnChartSnapshotTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StackedColumnChartSnapshotTests.swift; sourceTree = "<group>"; };
B8355ED825227E7E001AB341 /* BarChartSnapshotTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BarChartSnapshotTests.swift; sourceTree = "<group>"; };
B8355EDA25227F05001AB341 /* StackedBarChartSnapshotTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StackedBarChartSnapshotTests.swift; sourceTree = "<group>"; };
B8355EDC25227F87001AB341 /* BubbleChartSnapshotTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BubbleChartSnapshotTests.swift; sourceTree = "<group>"; };
B8355EDE25227F9B001AB341 /* ScatterChartSnapshotTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ScatterChartSnapshotTests.swift; sourceTree = "<group>"; };
B8355EE02522846B001AB341 /* RealColumnChartSnapshotTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RealColumnChartSnapshotTests.swift; sourceTree = "<group>"; };
B846F94526815CC90085044B /* ContactItemExample.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContactItemExample.swift; sourceTree = "<group>"; };
B846F94726815DE50085044B /* ContactItemRegularExamples.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContactItemRegularExamples.swift; sourceTree = "<group>"; };
B846F94926815DF30085044B /* ContactItemCompactExamples.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContactItemCompactExamples.swift; sourceTree = "<group>"; };
B84D24E52652F343007F2373 /* ObjectHeaderSpecCompact.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ObjectHeaderSpecCompact.swift; sourceTree = "<group>"; };
B84D24E62652F343007F2373 /* HeaderChartExample.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HeaderChartExample.swift; sourceTree = "<group>"; };
B84D24E72652F343007F2373 /* ObjectHeaderViewScenarios.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ObjectHeaderViewScenarios.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -620,6 +628,7 @@
8A5579C824C1293C0098003A /* FioriSwiftUICore */ = {
isa = PBXGroup;
children = (
B8239D8626815C11003455D2 /* ContactItem */,
692F338926556A34009B98DA /* SideBar */,
1FF3662C264C662A00AB8BD8 /* DimensionSelector */,
97CEF8A92553D6F1008BFBEF /* SignatureView */,
Expand Down Expand Up @@ -753,6 +762,17 @@
path = Onboarding;
sourceTree = "<group>";
};
B8239D8626815C11003455D2 /* ContactItem */ = {
isa = PBXGroup;
children = (
B846F94526815CC90085044B /* ContactItemExample.swift */,
B846F94726815DE50085044B /* ContactItemRegularExamples.swift */,
B846F94926815DF30085044B /* ContactItemCompactExamples.swift */,
B8101D51268BB84B00D32560 /* ContactItemTapStateExamples.swift */,
);
path = ContactItem;
sourceTree = "<group>";
};
B84D24E42652F343007F2373 /* ObjectHeader */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -951,6 +971,7 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
B8101D52268BB84B00D32560 /* ContactItemTapStateExamples.swift in Sources */,
8A55795724C1286E0098003A /* AppDelegate.swift in Sources */,
8A3C4E0424EB4A7B0084451B /* DataRequestTestCases.swift in Sources */,
691DE21925F2A30B00094D4A /* KPIViewExample.swift in Sources */,
Expand All @@ -971,6 +992,7 @@
8A5579D024C1293C0098003A /* SettingsLine.swift in Sources */,
8A557A2024C12C940098003A /* IntegrationCardsContentView.swift in Sources */,
B84D24ED2652F343007F2373 /* HeaderChartExample.swift in Sources */,
B846F94626815CC90085044B /* ContactItemExample.swift in Sources */,
8A5579CC24C1293C0098003A /* SettingsColorForCategory.swift in Sources */,
8A557A1A24C12C820098003A /* ChartsContentView.swift in Sources */,
8A5579CE24C1293C0098003A /* SettingColor.swift in Sources */,
Expand All @@ -988,12 +1010,14 @@
B8D437732609479E0024EE7D /* SingleActionFollowButton.swift in Sources */,
8AD9DFB325D49967007448EC /* ContactItemInitModelExample.swift in Sources */,
B84D24F12652F343007F2373 /* ObjectHeaderSpec.swift in Sources */,
B846F94A26815DF30085044B /* ContactItemCompactExamples.swift in Sources */,
8A5579D824C1293C0098003A /* SettingsIndexSet.swift in Sources */,
8A55795924C1286E0098003A /* SceneDelegate.swift in Sources */,
1FF3662E264C662A00AB8BD8 /* DimensionSelector+Chart.swift in Sources */,
8A55795B24C1286E0098003A /* ContentView.swift in Sources */,
1F26DCFA261A5CD9006C43B1 /* FioriButtonContentView.swift in Sources */,
B86F02AA267983870049DDA7 /* ObjectItemListView.swift in Sources */,
B846F94826815DE50085044B /* ContactItemRegularExamples.swift in Sources */,
8AD9DFB425D49967007448EC /* ContactItemInitViewBuilderExample.swift in Sources */,
B8D4376D25F97F140024EE7D /* ObjectItemExample.swift in Sources */,
8A6D64BF25AE7A6D00D2D76C /* ExperimentalContentView.swift in Sources */,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
import FioriSwiftUICore
import SwiftUI

struct ContactItemCompactExamples: ListDataProtocol {
init(cellTapped: Binding<Bool>) {}
init() {}

func numberOfSections() -> Int {
1
}

func numberOfRowsInSection(_ section: Int) -> Int {
6
}

func titleForHeaderInSection(_ section: Int) -> String {
switch section {
case 0:
return "General"
default:
return ""
}
}

func containAccessoryView(_ indexPath: IndexPath) -> Bool {
false
}

func cellForRow(_ indexPath: IndexPath) -> AnyView {
switch (indexPath.section, indexPath.row) {
case (0, 0):
let ci = ContactItem(title: "Seann Longname", actionItems: [.init(type: .phone), .init(type: .videoCall), .init(type: .message)]) { dataType in
print("\(dataType)")
}

return AnyView(ci)

case (0, 1):
let ci = ContactItem(title: "Headline example is allowd to wrap two lines ok", actionItems: [.init(type: .message)]) { dataType in
print("\(dataType)")
}

return AnyView(ci)

case (0, 2):
let ci = ContactItem(title: "Sean Long has a name that wraps two lines", detailImage: Image("person_square4").resizable(), actionItems: [.init(type: .phone), .init(type: .videoCall), .init(type: .message)]) { dataType in
print("\(dataType)")
}

return AnyView(ci)

case (0, 3):
let ci = ContactItem(title: "Headline example when it wrapps two lines", subtitle: "Team Lead", actionItems: [.init(type: .email), .init(type: .phone)]) { dataType in
print("\(dataType)")
}

return AnyView(ci)

case (0, 4):
let ci = ContactItem(title: "Seann Longname", subtitle: "Team Lead", actionItems: [.init(type: .phone), .init(type: .videoCall), .init(type: .message)]) { dataType in
print("\(dataType)")
}.splitPercent(0.3)

return AnyView(ci)

case (0, 5):
let ci = ContactItem(title: "Headline when\n wrapps 2 lines", subtitle: "Team Lead", detailImage: Image("person_square4").resizable(), actionItems: [.init(type: .phone), .init(type: .videoCall), .init(type: .message)]) { dataType in
print("\(dataType)")
}.splitPercent(0.3)

return AnyView(ci)

default:
return AnyView(ContactItem(title: "Lorem ipseum dolor"))
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import SwiftUI

struct ContactItemExample: View {
var body: some View {
List {
NavigationLink(destination: ObjectItemListView(title: "Regular View Examples", listDataType: ContactItemRegularExamples.self, changeLeftMargin: false, showEditButton: false)) {
Text("Regular View Examples")
}

NavigationLink(destination: ObjectItemListView(title: "Compact View Examples", listDataType: ContactItemCompactExamples.self, changeLeftMargin: false, showEditButton: false)) {
Text("Compact View Examples")
}

NavigationLink(destination: ContactItemTapStateExamples()) {
Text("Tap State Examples")
}
}.navigationBarTitle("ContactItem Examples", displayMode: .inline)
}
}

struct ContactItemExample_Previews: PreviewProvider {
static var previews: some View {
ContactItemExample()
}
}
Loading