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

[WEAV-73] 프로필 입력 - 성별선택 뷰 구현 #23

Merged
merged 2 commits into from
Oct 1, 2024
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
5 changes: 5 additions & 0 deletions Projects/App/Sources/Navigation/NavigationStack.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ extension PathType {
AuthPhoneVerifyView()
case .authAgreement:
AuthAgreementView()

case .authGreeting:
AuthGreetingView()
case .authProfileGender:
AuthProfileGenderInputView()
}
}
}
Expand Down
6 changes: 6 additions & 0 deletions Projects/Core/CommonKit/Sources/Path/PathTypes.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ public enum PathType: Hashable {
case .authPhoneInput: return "전화번호 입력"
case .authPhoneVerify: return "전화번호 인증"
case .authAgreement: return "이용 약관"

case .authGreeting: return "가입 후 환영"
case .authProfileGender: return "성별 입력"
}
}
}
Expand All @@ -39,4 +42,7 @@ public enum SignUpSubViewType: Hashable {
case authPhoneInput
case authPhoneVerify
case authAgreement

case authGreeting
case authProfileGender
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"filename" : "female_selected.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
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.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"filename" : "female_unselected.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
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.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"filename" : "male_selected.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
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.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"filename" : "male_unselected.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
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.
27 changes: 19 additions & 8 deletions Projects/DesignSystem/DesignCore/Sources/NavigationBar.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import SwiftUI

private struct NavigationBarViewModifier: ViewModifier {
var showLeftBackButton: Bool = true
var handler: () -> Void

func body(content: Content) -> some View {
Expand All @@ -17,20 +18,30 @@ private struct NavigationBarViewModifier: ViewModifier {
.toolbar(.visible, for: .navigationBar)
.toolbarTitleDisplayMode(.inline)
.toolbar {
ToolbarItem(placement: .topBarLeading) {
Button {
handler()
} label: {
DesignCore.Images.leftArrow.image
if showLeftBackButton {
ToolbarItem(placement: .topBarLeading) {
Button {
handler()
} label: {
DesignCore.Images.leftArrow.image
}

}

}
}
}
}

public extension View {
func setNavigation(handler: @escaping () -> Void) -> some View {
return modifier(NavigationBarViewModifier(handler: handler))
func setNavigation(
showLeftBackButton: Bool = true,
handler: @escaping () -> Void
) -> some View {
return modifier(
NavigationBarViewModifier(
showLeftBackButton: showLeftBackButton,
handler: handler
)
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ import CommonKit

public struct AuthAgreementView: View {

@State var isShowAlert = false

public init() {}

public var body: some View {
Expand All @@ -30,10 +28,9 @@ public struct AuthAgreementView: View {
Spacer()

CTABottomButton(title: "다음") {
isShowAlert = true
}
.alert("끝!!", isPresented: $isShowAlert) {

AppCoordinator.shared.push(
.signUp(.authGreeting)
)
}
}
.ignoresSafeArea(.all)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
//
// AuthGreetingView.swift
// DesignPreview
//
// Created by 김지수 on 10/1/24.
// Copyright © 2024 com.weave. All rights reserved.
//

import SwiftUI
import CommonKit
import DesignCore

public struct AuthGreetingView: View {
@State var isAppeared = false

public init() {}

public var body: some View {
VStack {
Text("만나서 반가워요!\n당신이 어떤 사람인지 알려주세요.")
.typography(.semibold_24)
.multilineTextAlignment(.center)
.foregroundStyle(DesignCore.Colors.grey500)
.opacity(isAppeared ? 1.0 : 0.0)
.offset(y: isAppeared ? 0 : -24)

Spacer()

CTAButton(title: "알려주러 가기") {
AppCoordinator.shared.push(
.signUp(.authProfileGender)
)
}
.padding(.horizontal, 24)
.opacity(isAppeared ? 1.0 : 0.0)
.offset(y: isAppeared ? 0 : -24)

Spacer()
}
.ignoresSafeArea()
.padding(.top, 155)
.textureBackground()
.onAppear {
withAnimation(.easeInOut(duration: 0.6)) {
isAppeared = true
}
}
}
}

#Preview {
AuthGreetingView()
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
//
// AuthProfileGenderInputView.swift
// DesignPreview
//
// Created by 김지수 on 10/1/24.
// Copyright © 2024 com.weave. All rights reserved.
//

import SwiftUI
import DesignCore
import CommonKit

enum GenderType: CaseIterable {
case male
case female

var unselectedImage: Image {
switch self {
case .male: DesignCore.Images.maleUnselected.image
case .female: DesignCore.Images.femaleUnselected.image
}
}

var selectedImage: Image {
switch self {
case .male: DesignCore.Images.maleSelected.image
case .female: DesignCore.Images.femaleSelected.image
}
}
}

public struct AuthProfileGenderInputView: View {
@State var selectedGender: GenderType?

public init() {}

public var body: some View {
VStack {
ProfileInputTemplatedView(
currentPage: 1,
maxPage: 5,
subMessage: "만나서 반가워요!",
mainMessage: "당신의 성별은 무엇인가요?"
) {
HStack(spacing: 0) {
Spacer()
ForEach(GenderType.allCases, id: \.self) { type in
if selectedGender == type {
type.selectedImage
.resizable()
.frame(width: 130, height: 130)
} else {
type.unselectedImage
.resizable()
.frame(width: 130, height: 130)
.onTapGesture {
withAnimation {
selectedGender = type
}
}
}
}
Spacer()
}
}

Spacer()

CTABottomButton(
title: "다음",
isActive: selectedGender != nil
) {

}
}
.padding(.top, 10)
.textureBackground()
.setNavigation(showLeftBackButton: false) {

}
}
}

#Preview {
NavigationView {
AuthProfileGenderInputView()
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
//
// ProfileInputTemplatedView.swift
// DesignPreview
//
// Created by 김지수 on 10/1/24.
// Copyright © 2024 com.weave. All rights reserved.
//

import SwiftUI
import DesignCore

struct ProfileInputTemplatedView<ContentView: View>: View {

let currentPage: Int
let maxPage: Int
let subMessage: String
let mainMessage: String
@ViewBuilder var contentView: () -> ContentView

var body: some View {
VStack(alignment: .leading, spacing: 20) {
HStack(spacing: 0) {
Text("\(currentPage)")
.foregroundStyle(DesignCore.Colors.blue300)
Text("/\(maxPage)")
.foregroundStyle(DesignCore.Colors.grey300)
}
.padding(.horizontal, 10)
.padding(.vertical, 2)
.background {
Capsule()
.foregroundStyle(.white)
}
.typography(.regular_15)
.padding(.horizontal, 26)

VStack(spacing: 0) {
LeftAlignText(subMessage)
.typography(.regular_14)
.foregroundStyle(DesignCore.Colors.grey200)
LeftAlignText(mainMessage)
.typography(.semibold_24)
.foregroundStyle(DesignCore.Colors.grey500)
}
.padding(.horizontal, 26)

contentView()
.padding(.horizontal, 26)
}
}
}
Loading