Skip to content

Commit

Permalink
feat: 馃幐 toolbar migration (#634)
Browse files Browse the repository at this point in the history
Co-authored-by: dyongxu <61523257+dyongxu@users.noreply.github.com>
  • Loading branch information
xiaoyu0722 and dyongxu committed Feb 27, 2024
1 parent 6bbb9d4 commit d859007
Show file tree
Hide file tree
Showing 6 changed files with 644 additions and 0 deletions.
16 changes: 16 additions & 0 deletions Apps/Examples/Examples.xcodeproj/project.pbxproj
Expand Up @@ -80,13 +80,15 @@
B18D593C2B0C52C700ABB1AD /* TabViewExample.swift in Sources */ = {isa = PBXBuildFile; fileRef = B18D593B2B0C52C700ABB1AD /* TabViewExample.swift */; };
B1BA1F922B19AAEE00E6C052 /* TabViewDetailView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B1BA1F912B19AAEE00E6C052 /* TabViewDetailView.swift */; };
B1BA1F942B1EC36100E6C052 /* 08 Tap.wav in Resources */ = {isa = PBXBuildFile; fileRef = B1BA1F932B1EC36100E6C052 /* 08 Tap.wav */; };
B1BA1F972B2167DC00E6C052 /* ToolbarExample.swift in Sources */ = {isa = PBXBuildFile; fileRef = B1BA1F962B2167DC00E6C052 /* ToolbarExample.swift */; };
B1C7DC8129FBB13F00DC5EEB /* SPIModelExample.swift in Sources */ = {isa = PBXBuildFile; fileRef = B1C7DC8029FBB13F00DC5EEB /* SPIModelExample.swift */; };
B1D41B20291A2D97004E64A5 /* DurationPickerExample.swift in Sources */ = {isa = PBXBuildFile; fileRef = B1D41B1F291A2D97004E64A5 /* DurationPickerExample.swift */; };
B1D9D22A2991E056008FF5BC /* ObjectItemAvatarsExample.swift in Sources */ = {isa = PBXBuildFile; fileRef = B1D9D2292991E056008FF5BC /* ObjectItemAvatarsExample.swift */; };
B1DD864F2B07441C00D7EDFD /* UIFont+Fiori.swift in Sources */ = {isa = PBXBuildFile; fileRef = B1DD864E2B07441C00D7EDFD /* UIFont+Fiori.swift */; };
B1DD86512B07534D00D7EDFD /* NavigationBarFioriStyle.swift in Sources */ = {isa = PBXBuildFile; fileRef = B1DD86502B07534D00D7EDFD /* NavigationBarFioriStyle.swift */; };
B1DD86532B0758F000D7EDFD /* NavigationBarPopover.swift in Sources */ = {isa = PBXBuildFile; fileRef = B1DD86522B0758F000D7EDFD /* NavigationBarPopover.swift */; };
B1DD86552B0759DD00D7EDFD /* NavigationBarCustomItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = B1DD86542B0759DD00D7EDFD /* NavigationBarCustomItem.swift */; };
B1F6FC302B22BDDA005190F9 /* ToolbarView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B1F6FC2F2B22BDDA005190F9 /* ToolbarView.swift */; };
B80DA9BA260BBF8600C0B2E9 /* SingleActionProfiles.swift in Sources */ = {isa = PBXBuildFile; fileRef = B80DA9B9260BBF8600C0B2E9 /* SingleActionProfiles.swift */; };
B80DA9BC260BED9400C0B2E9 /* SingleActionCollectionView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B80DA9BB260BED9400C0B2E9 /* SingleActionCollectionView.swift */; };
B80DA9BE260C1CC200C0B2E9 /* ListDataProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = B80DA9BD260C1CC200C0B2E9 /* ListDataProtocol.swift */; };
Expand Down Expand Up @@ -243,13 +245,15 @@
B18D593B2B0C52C700ABB1AD /* TabViewExample.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TabViewExample.swift; sourceTree = "<group>"; };
B1BA1F912B19AAEE00E6C052 /* TabViewDetailView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TabViewDetailView.swift; sourceTree = "<group>"; };
B1BA1F932B1EC36100E6C052 /* 08 Tap.wav */ = {isa = PBXFileReference; lastKnownFileType = audio.wav; path = "08 Tap.wav"; sourceTree = "<group>"; };
B1BA1F962B2167DC00E6C052 /* ToolbarExample.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ToolbarExample.swift; sourceTree = "<group>"; };
B1C7DC8029FBB13F00DC5EEB /* SPIModelExample.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SPIModelExample.swift; sourceTree = "<group>"; };
B1D41B1F291A2D97004E64A5 /* DurationPickerExample.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DurationPickerExample.swift; sourceTree = "<group>"; };
B1D9D2292991E056008FF5BC /* ObjectItemAvatarsExample.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ObjectItemAvatarsExample.swift; sourceTree = "<group>"; };
B1DD864E2B07441C00D7EDFD /* UIFont+Fiori.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIFont+Fiori.swift"; sourceTree = "<group>"; };
B1DD86502B07534D00D7EDFD /* NavigationBarFioriStyle.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NavigationBarFioriStyle.swift; sourceTree = "<group>"; };
B1DD86522B0758F000D7EDFD /* NavigationBarPopover.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NavigationBarPopover.swift; sourceTree = "<group>"; };
B1DD86542B0759DD00D7EDFD /* NavigationBarCustomItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NavigationBarCustomItem.swift; sourceTree = "<group>"; };
B1F6FC2F2B22BDDA005190F9 /* ToolbarView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ToolbarView.swift; sourceTree = "<group>"; };
B80DA9B9260BBF8600C0B2E9 /* SingleActionProfiles.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SingleActionProfiles.swift; sourceTree = "<group>"; };
B80DA9BB260BED9400C0B2E9 /* SingleActionCollectionView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SingleActionCollectionView.swift; sourceTree = "<group>"; };
B80DA9BD260C1CC200C0B2E9 /* ListDataProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListDataProtocol.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -475,6 +479,7 @@
99658F862B7C35630026A743 /* Indicator */,
B88CB6102B716C0300013B37 /* Card */,
C18868CF2B3252F400F865F7 /* SearchBar */,
B1BA1F952B2167BE00E6C052 /* ToolbarExample */,
B1BA1F902B19A8B500E6C052 /* TabViewExample */,
B1CC61C52AFA0856002078C1 /* NavigationBar */,
C1C764862A818BD600BCB0F7 /* SortFilter */,
Expand Down Expand Up @@ -580,6 +585,15 @@
path = TabViewExample;
sourceTree = "<group>";
};
B1BA1F952B2167BE00E6C052 /* ToolbarExample */ = {
isa = PBXGroup;
children = (
B1BA1F962B2167DC00E6C052 /* ToolbarExample.swift */,
B1F6FC2F2B22BDDA005190F9 /* ToolbarView.swift */,
);
path = ToolbarExample;
sourceTree = "<group>";
};
B1CC61C52AFA0856002078C1 /* NavigationBar */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -825,6 +839,7 @@
B8101D52268BB84B00D32560 /* ContactItemTapStateExamples.swift in Sources */,
8A55795724C1286E0098003A /* AppDelegate.swift in Sources */,
C106AD4A2B33970500FE8B35 /* SearchPromptFontAndColor.swift in Sources */,
B1BA1F972B2167DC00E6C052 /* ToolbarExample.swift in Sources */,
B18D2E9F2988B07B000A1821 /* KPIHeaderExample.swift in Sources */,
8AB6C01428DF6583002F32BE /* LazyView.swift in Sources */,
691DE21925F2A30B00094D4A /* KPIViewExample.swift in Sources */,
Expand Down Expand Up @@ -917,6 +932,7 @@
8A557A2224C12C9B0098003A /* CoreContentView.swift in Sources */,
8A5579D224C1293C0098003A /* Color+Extensions.swift in Sources */,
C1C764882A818BEC00BCB0F7 /* SortFilterExample.swift in Sources */,
B1F6FC302B22BDDA005190F9 /* ToolbarView.swift in Sources */,
B84D24EF2652F343007F2373 /* ObjectHeaderTestApp.swift in Sources */,
B84D24EC2652F343007F2373 /* ObjectHeaderSpecCompact.swift in Sources */,
8A5579CD24C1293C0098003A /* SettingsLabel.swift in Sources */,
Expand Down
5 changes: 5 additions & 0 deletions Apps/Examples/Examples/FioriSwiftUICore/CoreContentView.swift
Expand Up @@ -48,6 +48,11 @@ struct CoreContentView: View {
destination: TabViewExample()) {
Text("Customized TabView")
}

NavigationLink(
destination: ToolbarExample()) {
Text("Customized Toolbar")
}
}

NavigationLink(
Expand Down
@@ -0,0 +1,117 @@
import FioriSwiftUICore
import SwiftUI

struct ToolbarExample: View {
@State var isPresented: Bool = false
@State var isPresented2: Bool = false
@State var numberOfButtons: Int = 2
@State var useFioriToolbar: Bool = true
@State var helperText: String = ""
@State var customHelperText: Bool = false
@State var customOverflowIcon: Bool = false
@State var primaryButton: String = ""
@State var secondaryButton: String = ""
@State var thirdButton: String = ""
@State var buttonType: ItemStyle = .fiori

var body: some View {
Form {
HStack {
Text("Selecte to Test")
Spacer()
}
.contentShape(Rectangle())
.onTapGesture {
isPresented.toggle()
}
.sheet(isPresented: $isPresented) {
NavigationStack {
ToolbarView(numberOfButtons: $numberOfButtons, useFioriToolbar: $useFioriToolbar, helperText: $helperText, customHelperText: $customHelperText, customOverflowIcon: $customOverflowIcon, primaryButtonText: $primaryButton, secondaryButtonText: $secondaryButton, thirdButtonText: $thirdButton, buttonType: $buttonType)
}
}

Picker("Number of Buttons", selection: $numberOfButtons) {
ForEach(0 ..< 8, id: \.self) { index in
Text("\(index + 1)").tag(index + 1)
}
}

Toggle("Use FioriToolbar", isOn: $useFioriToolbar)

Picker("Button Type", selection: $buttonType) {
Text("Fiori Button").tag(ItemStyle.fiori)
Text("Icon").tag(ItemStyle.icon)
Text("SiwftUI Button").tag(ItemStyle.button)
}

Picker("Helper Text", selection: $helperText) {
Text("None").tag("")
Text("Short").tag("Helper Text")
Text("Long").tag("Long Long Long Long Long Helper Text")
Text("Extra Long").tag("Extra Extra Extra Extra Extra Extra Extra Long Long Long Long Long Helper Text")
Text("Extra Extra Long").tag("Extra Extra Extra Extra Extra Extra Extra Extra Extra Extra Extra Extra Long Long Long Long Long Helper Text")
}

Group {
Toggle("Custom Helper Text Color & Font", isOn: $customHelperText)

Toggle("Custom Overflow Icon", isOn: $customOverflowIcon)
}

Picker("Primary Button", selection: $primaryButton) {
Text("None").tag("")
Text("Long Primary Button").tag("Long Long Primary Button Title")
Text("Extra Long Primary Button").tag("Extra Long Long Long Long Long Long Long Long Long Long Long Long Primary Button Title")
}

Picker("Secondary Button", selection: $secondaryButton) {
Text("None").tag("")
Text("Long Secondary Button").tag("Long Secondary Button Title")
Text("Extra Long Secondary Button").tag("Extra Long Long Long Long Long Long Long LongLong Long Secondary Button Title")
}

Picker("3rd Button", selection: $thirdButton) {
Text("None").tag("")
Text("Long 3rd Button").tag("Long Long Long Button Title")
Text("Extra Long 3rd Button").tag("Extra Long Long Long Long Long Long Long LongLong Long Long Button Title")
}

Section {
HStack {
Text("Special example that toolbar filled with items")
Spacer()
}
.contentShape(Rectangle())
.onTapGesture {
isPresented2.toggle()
}
.sheet(isPresented: $isPresented2) {
NavigationStack {
Color.preferredColor(.grey7)
.overlay {
Text("This is an example that toolbar filled with expandable buttons")
}
.fioriToolbar {
HStack {
FioriButton { _ in
Text("Save")
.frame(maxWidth: .infinity)
}
FioriButton { _ in
Text("Submit")
.frame(maxWidth: .infinity)
}
}
}
}
}
}
}
}
}

#Preview {
NavigationStack {
ToolbarExample()
}
}

0 comments on commit d859007

Please sign in to comment.