Skip to content

Commit

Permalink
[#46] 검색 / 새공고 뷰 레이아웃 구현
Browse files Browse the repository at this point in the history
  • Loading branch information
kimsoomin20221789 committed Jan 22, 2024
1 parent 2465cb7 commit d4ee7de
Show file tree
Hide file tree
Showing 19 changed files with 595 additions and 82 deletions.
16 changes: 14 additions & 2 deletions Spon-us.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@
3BFC8D1B2B54D46D000D6006 /* MultiImagePicker.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3BFC8D1A2B54D46D000D6006 /* MultiImagePicker.swift */; };
3BFC8D1F2B5597C9000D6006 /* ProfileView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3BFC8D1E2B5597C9000D6006 /* ProfileView.swift */; };
807BF83F2B51BCD400A659B9 /* SearchView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 807BF83E2B51BCD400A659B9 /* SearchView.swift */; };
80FA31672B5EB5F90076453B /* SearchPostView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 80FA31662B5EB5F90076453B /* SearchPostView.swift */; };
80FA31692B5EB9490076453B /* NewPostView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 80FA31682B5EB9490076453B /* NewPostView.swift */; };
80FA316D2B5EBA6B0076453B /* SearchOfferView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 80FA316C2B5EBA6B0076453B /* SearchOfferView.swift */; };
DF91F4042B4864330021291A /* Portfolio.swift in Sources */ = {isa = PBXBuildFile; fileRef = DF91F4032B4864330021291A /* Portfolio.swift */; };
DFCD247C2B54D08100B00515 /* PopupView in Frameworks */ = {isa = PBXBuildFile; productRef = DFCD247B2B54D08100B00515 /* PopupView */; };
DFCD24822B5A67FC00B00515 /* DocumentPicker.swift in Sources */ = {isa = PBXBuildFile; fileRef = DFCD24812B5A67FC00B00515 /* DocumentPicker.swift */; };
Expand Down Expand Up @@ -57,6 +60,9 @@
3BFC8D1A2B54D46D000D6006 /* MultiImagePicker.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MultiImagePicker.swift; sourceTree = "<group>"; };
3BFC8D1E2B5597C9000D6006 /* ProfileView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProfileView.swift; sourceTree = "<group>"; };
807BF83E2B51BCD400A659B9 /* SearchView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SearchView.swift; sourceTree = "<group>"; };
80FA31662B5EB5F90076453B /* SearchPostView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = SearchPostView.swift; path = "../../../../.Trash/SponUs-iOS 오후 11.33.52/Spon-us/View/SearchPostView.swift"; sourceTree = "<group>"; };
80FA31682B5EB9490076453B /* NewPostView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NewPostView.swift; sourceTree = "<group>"; };
80FA316C2B5EBA6B0076453B /* SearchOfferView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SearchOfferView.swift; sourceTree = "<group>"; };
DF91F4032B4864330021291A /* Portfolio.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Portfolio.swift; sourceTree = "<group>"; };
DFCD24812B5A67FC00B00515 /* DocumentPicker.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DocumentPicker.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */
Expand Down Expand Up @@ -134,6 +140,9 @@
DF91F4032B4864330021291A /* Portfolio.swift */,
100D38B22B4EF15600498977 /* HomeView.swift */,
807BF83E2B51BCD400A659B9 /* SearchView.swift */,
80FA31662B5EB5F90076453B /* SearchPostView.swift */,
80FA316C2B5EBA6B0076453B /* SearchOfferView.swift */,
80FA31682B5EB9490076453B /* NewPostView.swift */,
10C8AC5F2B5C33D900B40547 /* SendOffer */,
100D38B52B4EF51E00498977 /* SavedView.swift */,
100D38B72B4EF54100498977 /* CategoryView.swift */,
Expand Down Expand Up @@ -247,9 +256,11 @@
3BFC8D152B54AA55000D6006 /* EditPostView.swift in Sources */,
100D389A2B44833500498977 /* FontManager.swift in Sources */,
100D38B62B4EF51E00498977 /* SavedView.swift in Sources */,
80FA31692B5EB9490076453B /* NewPostView.swift in Sources */,
100D38B82B4EF54100498977 /* CategoryView.swift in Sources */,
3BFC8D1B2B54D46D000D6006 /* MultiImagePicker.swift in Sources */,
100D38B32B4EF15600498977 /* HomeView.swift in Sources */,
80FA31672B5EB5F90076453B /* SearchPostView.swift in Sources */,
10C8AC632B5C34C400B40547 /* CompanyPostView.swift in Sources */,
3BFC8D1F2B5597C9000D6006 /* ProfileView.swift in Sources */,
100D38B12B44852700498977 /* ContentView.swift in Sources */,
Expand All @@ -258,6 +269,7 @@
807BF83F2B51BCD400A659B9 /* SearchView.swift in Sources */,
100D38A72B44836800498977 /* Spon_usApp.swift in Sources */,
DFCD24822B5A67FC00B00515 /* DocumentPicker.swift in Sources */,
80FA316D2B5EBA6B0076453B /* SearchOfferView.swift in Sources */,
3B2021772B4C56000010CA02 /* ProposalReceivedListView.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down Expand Up @@ -392,7 +404,7 @@
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_ASSET_PATHS = "\"Spon-us/Preview Content\"";
DEVELOPMENT_TEAM = "";
DEVELOPMENT_TEAM = QRPAUP59QL;
ENABLE_PREVIEWS = YES;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = "Spon-us/Info.plist";
Expand Down Expand Up @@ -423,7 +435,7 @@
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_ASSET_PATHS = "\"Spon-us/Preview Content\"";
DEVELOPMENT_TEAM = "";
DEVELOPMENT_TEAM = QRPAUP59QL;
ENABLE_PREVIEWS = YES;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = "Spon-us/Info.plist";
Expand Down
6 changes: 3 additions & 3 deletions Spon-us/Assets.xcassets/company_dummy.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
{
"images" : [
{
"filename" : "Image.png",
"filename" : "Ellipse 88.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "Image 1.png",
"filename" : "Ellipse 88@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "Image 2.png",
"filename" : "Ellipse 88@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 23 additions & 0 deletions Spon-us/Assets.xcassets/ic_saved_white.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"filename" : "Bookmark.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
2 changes: 1 addition & 1 deletion Spon-us/EditPostView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ struct PostRectangleCell: View {
.lineLimit(1)
.overlay(
Rectangle()
.stroke(item == selectedString ? Color.sponusBlack : Color.sponusGrey600, lineWidth: 1)
.stroke(item == selectedString ? Color.sponusBlack : Color.sponusGrey100, lineWidth: 1)
.frame(maxWidth: .infinity)
)
})
Expand Down
2 changes: 1 addition & 1 deletion Spon-us/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
<array>
<string>Pretendard-SemiBold.otf</string>
<string>Pretendard-Medium.otf</string>
<string>SUIT-Bold.otf</string>
<string>SUIT-Medium.otf</string>
<string>SUIT-Bold.otf</string>
</array>
</dict>
</plist>
4 changes: 1 addition & 3 deletions Spon-us/View/HomeView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -236,9 +236,7 @@ struct HomeView: View {
.padding(.leading, 14)
}

Button(action: {

}) {
NavigationLink(destination: NewPostView(popup: .constant(false))){
VStack {
ZStack {
RoundedRectangle(cornerRadius: 16)
Expand Down
174 changes: 174 additions & 0 deletions Spon-us/View/NewPostView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,174 @@
//
// NewPostView.swift
// Spon-us
//
// Created by 김수민 on 1/22/24.
//

import SwiftUI
import PopupView
import UniformTypeIdentifiers
import MobileCoreServices


struct NewPostView: View {

@State private var postTitle = ""
@State private var selectedImages: [UIImage] = []
@State private var postSelectedCategory = ""
@State private var postSelectedField = ""
@State private var postDetail = ""

@State var showingPopup = false
@State var showingPreviewAlert = false
@State var goToPreview = false
@Binding var popup: Bool

@Environment(\.presentationMode) var presentationMode
func createPopup() -> some View {
HStack {
Text("작성이 완료되었습니다").font(.Body03).foregroundStyle(.sponusPrimary)
}.frame(height: 56).frame(maxWidth: .infinity).background(Color.sponusSecondary)
}

let postCategory = ["협찬", "제휴", "연계프로젝트"]
let postField = ["기획/아이디어", "광고/마케팅", "디자인", "사진/영상", "IT/소프트웨어/게임", "기타"]
let postField1 = ["기획/아이디어", "광고/마케팅", "디자인"]
let postField2 = ["사진/영상", "IT/소프트웨어/게임", "기타"]

var body: some View {
// NavigationView {
VStack(spacing: 0) {
var compleBtnInActive = postTitle.isEmpty || selectedImages.isEmpty || postSelectedCategory.isEmpty || postSelectedField.isEmpty || postDetail.isEmpty
ScrollView {
VStack(alignment: .leading, spacing: 16){

SponUsPostCell(text: "공고 제목", isComplete: $postTitle).padding(.top, 10)

TextField("ex. 스포대학교 대학생 협찬", text: $postTitle)
.textFieldStyle(SponUsTextfieldStyle())
.frame(height: 56)
.padding(.bottom, 16)

SponUsPostImageCell(text: "공고 이미지", selectedImages: $selectedImages)

// SponUsDivider()

MultipleImagePicker(selectedImages: $selectedImages)
.padding(.bottom, 16)

SponUsPostCell(text: "유형", isComplete: $postSelectedCategory)

HStack(spacing: 8) {
ForEach(postCategory, id: \.self) { item in
PostRectangleCell(item: item, selectedString: $postSelectedCategory)
}
}
.padding(.bottom, 16)

SponUsPostCell(text: "분야", isComplete: $postSelectedField)

HStack(spacing: 8) {
ForEach(postField1, id: \.self) { item in
PostRectangleCell(item: item, selectedString: $postSelectedField)
}
}

HStack(spacing: 8) {
ForEach(postField2, id: \.self) { item in
PostRectangleCell(item: item, selectedString: $postSelectedField)
}
}
.padding(.bottom, 16)

SponUsPostCell(text: "공고 내용", isComplete: $postDetail)

ZStack {

Rectangle()
.stroke(Color.sponusGrey100, lineWidth: 1)
.fill(Color.clear)
.frame(maxWidth: .infinity, minHeight: 225)
.overlay(
VStack {
Text("공고에 대한 자세한 내용을 적어주세요.\nex. 진행 배경, 진행 내용, 기대 효과, 희망 사항")
.font(.Caption02)
.padding(.top, 20)
.foregroundColor(postDetail.isEmpty ? Color.sponusGrey600 : Color.clear)

Spacer()
}
)
.zIndex(1.0)

TextEditor(text: $postDetail)
.padding(.horizontal, 20)
.padding(.vertical, 8)

}

HStack {
Spacer()
Button {
if (compleBtnInActive == true) {
showingPreviewAlert = true
}
else {
goToPreview = true
}
}
label: {
Text("미리보기").font(.Body10).foregroundStyle(.sponusGrey700).frame(width: 73, height: 37)
}.border(.sponusGrey700)
Spacer()
}.padding(.top, 32)

Spacer().frame(height: 127)

}
.font(.Heading09)
.foregroundColor(Color.sponusBlack)
.padding(.horizontal, 20)
.padding(.bottom, 20)
}

Button(action: {
// self.presentationMode.wrappedValue.dismiss()
showingPopup = true
}, label: {
Text("작성 완료")
.font(.Body01)
.foregroundColor(compleBtnInActive ? Color.sponusGrey200 : Color.sponusPrimaryDarkmode)
.frame(maxWidth: .infinity)
.padding(.top, 20)
.background(compleBtnInActive ? Color.sponusGrey600 : Color.sponusBlack)
}).disabled(compleBtnInActive)
.navigationDestination(isPresented: $goToPreview) {

}
}.popup(isPresented: $showingPopup) {
createPopup().onDisappear(){
self.presentationMode.wrappedValue.dismiss()
}
} customize: {
$0.type(.floater(verticalPadding: 16))
.position(.bottom)
.animation(.spring)
.closeOnTap(true)
.closeOnTapOutside(true)
.autohideIn(2)
}
.navigationTitle("새 공고 작성").font(.Body01)
.navigationBarTitleDisplayMode(.inline)
.navigationBarBackButtonHidden(true)
.navigationBarItems(leading: CustomBackButton())
.toolbar(.hidden, for: .tabBar)
.onDisappear{
print("disappear")
}
}
}
#Preview {
NewPostView(popup: .constant(false))
}

Loading

0 comments on commit d4ee7de

Please sign in to comment.