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

作品投稿画面のテンプレート #57

Closed
wants to merge 5 commits into from
Closed
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
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
AA31E7FC28F542D900DCE061 /* TestView2.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA31E7FB28F542D900DCE061 /* TestView2.swift */; };
AA31E800290F9C9F00DCE061 /* TabBarView.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA31E7FF290F9C9F00DCE061 /* TabBarView.swift */; };
AADD20EC292B6A45008EE02E /* PublishingSettingToggleButtonView.swift in Sources */ = {isa = PBXBuildFile; fileRef = AADD20EB292B6A45008EE02E /* PublishingSettingToggleButtonView.swift */; };
AB1FDCC52A6F8EE6006E0AA1 /* WorkPostView.swift in Sources */ = {isa = PBXBuildFile; fileRef = AB1FDCC42A6F8EE6006E0AA1 /* WorkPostView.swift */; };
AB27895C2A1B4A540013C829 /* ImageSelectView.swift in Sources */ = {isa = PBXBuildFile; fileRef = AB27895B2A1B4A540013C829 /* ImageSelectView.swift */; };
ABAE5BEB28604E4A008ED665 /* .swiftlint.yml in Resources */ = {isa = PBXBuildFile; fileRef = ABAE5BEA28604E4A008ED665 /* .swiftlint.yml */; };
ABAF1D1B283B78F100F890BC /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = ABAF1D1A283B78F100F890BC /* ContentView.swift */; };
Expand All @@ -41,6 +42,7 @@
AA31E7FB28F542D900DCE061 /* TestView2.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TestView2.swift; sourceTree = "<group>"; };
AA31E7FF290F9C9F00DCE061 /* TabBarView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TabBarView.swift; sourceTree = "<group>"; };
AADD20EB292B6A45008EE02E /* PublishingSettingToggleButtonView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PublishingSettingToggleButtonView.swift; sourceTree = "<group>"; };
AB1FDCC42A6F8EE6006E0AA1 /* WorkPostView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = WorkPostView.swift; path = "portfolio-ios-swiftui/View/Molecules/WorkPostView.swift"; sourceTree = SOURCE_ROOT; };
AB27895B2A1B4A540013C829 /* ImageSelectView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ImageSelectView.swift; sourceTree = "<group>"; };
ABAE5BEA28604E4A008ED665 /* .swiftlint.yml */ = {isa = PBXFileReference; lastKnownFileType = text.yaml; path = .swiftlint.yml; sourceTree = "<group>"; };
ABAF1D15283B78F100F890BC /* portfolio-ios-swiftui.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "portfolio-ios-swiftui.app"; sourceTree = BUILT_PRODUCTS_DIR; };
Expand Down Expand Up @@ -78,6 +80,38 @@
path = Organism;
sourceTree = "<group>";
};
AB1FDCC32A6F8ED7006E0AA1 /* WorkPost */ = {
isa = PBXGroup;
children = (
AB1FDCC82A6F8F32006E0AA1 /* ViewModel */,
AB1FDCC72A6F8F23006E0AA1 /* Service */,
AB1FDCC62A6F8F16006E0AA1 /* Model */,
AB1FDCC42A6F8EE6006E0AA1 /* WorkPostView.swift */,
);
path = WorkPost;
sourceTree = "<group>";
};
AB1FDCC62A6F8F16006E0AA1 /* Model */ = {
isa = PBXGroup;
children = (
);
path = Model;
sourceTree = "<group>";
};
AB1FDCC72A6F8F23006E0AA1 /* Service */ = {
isa = PBXGroup;
children = (
);
path = Service;
sourceTree = "<group>";
};
AB1FDCC82A6F8F32006E0AA1 /* ViewModel */ = {
isa = PBXGroup;
children = (
);
path = ViewModel;
sourceTree = "<group>";
};
ABAF1D0C283B78F100F890BC = {
isa = PBXGroup;
children = (
Expand All @@ -98,6 +132,7 @@
ABAF1D17283B78F100F890BC /* portfolio-ios-swiftui */ = {
isa = PBXGroup;
children = (
AB1FDCC32A6F8ED7006E0AA1 /* WorkPost */,
ABB3AD30284DEA84004C012E /* View */,
ABC44B162918F62D00BBE1A6 /* Login */,
ABAF1D1A283B78F100F890BC /* ContentView.swift */,
Expand Down Expand Up @@ -287,6 +322,7 @@
AB27895C2A1B4A540013C829 /* ImageSelectView.swift in Sources */,
AA31E800290F9C9F00DCE061 /* TabBarView.swift in Sources */,
0CF733722A2DBB7200680560 /* CollectionView.swift in Sources */,
AB1FDCC52A6F8EE6006E0AA1 /* WorkPostView.swift in Sources */,
AA31E7F828EAD00B00DCE061 /* FloatingActionButtonView.swift in Sources */,
AA31E7FA28F542C700DCE061 /* TestView1.swift in Sources */,
0CFE7BC3286A2A6500CA5119 /* ButtonView.swift in Sources */,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,24 @@ import SwiftUI
struct BaseButtonView: View {
var action: () -> Void
var labelText: String
var textSize: CGFloat?
var foregroundColor: Color
var backgroundColor: Color
var radius: CGFloat
var lineColor: Color
var width: CGFloat?
var height: CGFloat?

init(action: @escaping () -> Void, labelText: String, foregroundColor: Color, backgroundColor: Color, radius: CGFloat? = 0, lineColor: Color? = Color.clear) {
init(action: @escaping () -> Void, labelText: String, textSize: CGFloat? = nil, foregroundColor: Color, backgroundColor: Color, radius: CGFloat? = 0, lineColor: Color? = Color.clear, width: CGFloat? = nil, height: CGFloat? = nil) {
self.action = action
self.labelText = labelText
self.textSize = textSize
self.backgroundColor = backgroundColor
self.foregroundColor = foregroundColor
self.radius = radius ?? 0
self.lineColor = lineColor ?? Color.clear
self.width = width
self.height = height
}

private func getWidthSize(text: String) -> CGFloat {
Expand Down Expand Up @@ -48,8 +54,8 @@ struct BaseButtonView: View {
let widthSize = getWidthSize(text: words)

Text(words)
.font(.system(size: 20))
.frame(width: widthSize, height: 50)
.font(.system(size: textSize ?? 20))
.frame(width: width ?? getWidthSize(text: words), height: height ?? 50)
.lineLimit(1)
.foregroundColor(foregroundColor)
.background(backgroundColor)
Expand Down Expand Up @@ -83,7 +89,14 @@ struct CommonButtonView_Previews: PreviewProvider {
foregroundColor: Color.text,
backgroundColor: Color.grayBottonColor, radius: 25
)

BaseButtonView(
action: { print("何か処理をするよー") },
labelText: "投稿",
textSize: 15,
foregroundColor: Color.white,
backgroundColor: Color.subPink, radius: 25,
height: 40
)
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
//
// PostView.swift
// portfolio-ios-swiftui
//
// Created by Takeru Sakakibara on 2023/06/26.
//

import SwiftUI

struct PostView: View {
@State private var publishing = false
var body: some View {
VStack(alignment: .leading) {
HStack {
Button(action: {
// ここにアクションを追加する
}) {
Image(systemName: "lessthan")
.resizable()
.frame(width: 25, height: 40)
.foregroundColor(.gray)
}
IconView(imageName: "", iconPattern: .small)
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
)
}
Divider()
.frame(width: 350, height: 1)
.background(Color.black)
Text("公開設定")
.padding(.leading, 22)
.foregroundColor(Color.text)
Toggle("公開", isOn: $publishing)
.toggleStyle(SwitchToggleStyle(tint: .textPinkColor))
.frame(width: 100)
.padding(.leading, 30)
TextBox(text: "タイトル")
.padding(20)
TextBox(text: "説明文")
.padding(20)
TextBox(text: "Githubリンク")
.padding(20)
TextBox(text: "Youtubeリンク")
.padding(20)
// tagのviewはここに

// 写真追加も

}
}
}

struct PostView_Previews: PreviewProvider {
static var previews: some View {
PostView()
}
}