diff --git a/portfolio-ios-swiftui/portfolio-ios-swiftui.xcodeproj/project.pbxproj b/portfolio-ios-swiftui/portfolio-ios-swiftui.xcodeproj/project.pbxproj index e32c32b..a625c50 100644 --- a/portfolio-ios-swiftui/portfolio-ios-swiftui.xcodeproj/project.pbxproj +++ b/portfolio-ios-swiftui/portfolio-ios-swiftui.xcodeproj/project.pbxproj @@ -13,6 +13,7 @@ 0CF733722A2DBB7200680560 /* CollectionView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0CF733712A2DBB7200680560 /* CollectionView.swift */; }; 0CF733742A36FA2000680560 /* TagView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0CF733732A36FA2000680560 /* TagView.swift */; }; 0CFE7BC3286A2A6500CA5119 /* ButtonView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0CFE7BC2286A2A6500CA5119 /* ButtonView.swift */; }; + AA157CF52AE6460100007BFA /* PostView.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA157CF42AE6460100007BFA /* PostView.swift */; }; AA31E7F828EAD00B00DCE061 /* FloatingActionButtonView.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA31E7F728EAD00B00DCE061 /* FloatingActionButtonView.swift */; }; AA31E7FA28F542C700DCE061 /* TestView1.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA31E7F928F542C700DCE061 /* TestView1.swift */; }; AA31E7FC28F542D900DCE061 /* TestView2.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA31E7FB28F542D900DCE061 /* TestView2.swift */; }; @@ -48,6 +49,7 @@ 0CF733712A2DBB7200680560 /* CollectionView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CollectionView.swift; sourceTree = ""; }; 0CF733732A36FA2000680560 /* TagView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TagView.swift; sourceTree = ""; }; 0CFE7BC2286A2A6500CA5119 /* ButtonView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ButtonView.swift; sourceTree = ""; }; + AA157CF42AE6460100007BFA /* PostView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PostView.swift; sourceTree = ""; }; AA31E7F728EAD00B00DCE061 /* FloatingActionButtonView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FloatingActionButtonView.swift; sourceTree = ""; }; AA31E7F928F542C700DCE061 /* TestView1.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TestView1.swift; sourceTree = ""; }; AA31E7FB28F542D900DCE061 /* TestView2.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TestView2.swift; sourceTree = ""; }; @@ -113,6 +115,7 @@ isa = PBXGroup; children = ( AB633C89299F1A2100F57244 /* ImageSelectView.swift */, + AA157CF42AE6460100007BFA /* PostView.swift */, ); path = Molecules; sourceTree = ""; @@ -374,6 +377,7 @@ 0CFE7BC3286A2A6500CA5119 /* ButtonView.swift in Sources */, ABC44B212918F62D00BBE1A6 /* LoginPage.swift in Sources */, ABC44B252918F62D00BBE1A6 /* LoginService.swift in Sources */, + AA157CF52AE6460100007BFA /* PostView.swift in Sources */, FC7EC30D28EAC89300600302 /* TextField.swift in Sources */, AADD20EC292B6A45008EE02E /* PublishingSettingToggleButtonView.swift in Sources */, ABC44B242918F62D00BBE1A6 /* APIServiceError.swift in Sources */, diff --git a/portfolio-ios-swiftui/portfolio-ios-swiftui/View/Molecules/PostView.swift b/portfolio-ios-swiftui/portfolio-ios-swiftui/View/Molecules/PostView.swift new file mode 100644 index 0000000..9e65da6 --- /dev/null +++ b/portfolio-ios-swiftui/portfolio-ios-swiftui/View/Molecules/PostView.swift @@ -0,0 +1,121 @@ +// +// PostView.swift +// portfolio-ios-swiftui +// +// Created by Takeru Sakakibara on 2023/06/26. +// + +import SwiftUI + +struct PostView: View { + @State private var publishing = false + + @State private var title: String = "" + @State private var description: String = "" + @State private var githubLink: String = "" + @State private var youtubeLink: String = "" + + @FocusState var focus: Bool + + var body: some View { + VStack(alignment: .leading) { + HStack { + Button( + action: { + // ここにアクションを追加する + }, + label: { + SwiftUI.Image(systemName: "lessthan") + .resizable() + .frame(width: 15, height: 30) + .foregroundColor(.gray) + } + ) + .padding(.leading) + + IconView( + imageName: URL( + string: "https://pbs.twimg.com/media/Fx_ZC9saQAAI4Z5?format=jpg&name=large"), + iconPattern: .small + ) + Spacer() + BaseButtonView( + action: { print("何か処理をするよー") }, + labelText: "下書き", + foregroundColor: Color.textPinkColor, + backgroundColor: Color.clear, radius: 25, lineColor: Color.textPinkColor + ) + BaseButtonView( + action: { print("何か処理をするよー") }, + labelText: "投稿", + foregroundColor: Color.white, + backgroundColor: Color.subPink, radius: 25 + ) + .padding(.trailing) + } + Divider() + .frame(width: 360, height: 1) + .background(Color.black) + .padding(EdgeInsets( + top: 10, + leading: 15, + bottom: 10, + trailing: 0 + )) + + ScrollView { + HStack { + Text("公開設定") + .padding(.leading, 28) + .foregroundColor(Color.text) + Spacer() + } + HStack { + Toggle("公開", isOn: $publishing) + .toggleStyle(SwitchToggleStyle(tint: .textPinkColor)) + .frame(width: 100, alignment: .leading) + .padding(.leading, 35) + Spacer() + // 上記は、.leadingの指定を受け付けてくれないのでこのような実装に + } + TextBox(inputText: $title, titleText: "タイトル", width: 300, isRequired: true) + .padding(20) + TextBox(inputText: $description, titleText: "説明文", lines: 6...6) + .padding(20) + TextBox(inputText: $githubLink, titleText: "Githubリンク", width: 300) + .padding(20) + TextBox(inputText: $youtubeLink, titleText: "Youtubeリンク", width: 300) + .padding(20) + // tagのviewはここに + let item = ["おはよう", "こんにちは", "さようなら"] + + HStack { + Text("タグの追加") + .padding(.leading, 28) + .foregroundColor(Color.text) + Spacer() + } + TagView(item: item, viewPattern: .detail) + // 写真追加も + + } + .focused(self.$focus) + .toolbar { + ToolbarItem(placement: .keyboard) { + HStack { + Spacer() + Button("完了") { + self.focus = false + } + } + } + } + } + } +} + +struct PostView_Previews: PreviewProvider { + static var previews: some View { + PostView() + } +}