Skip to content

Commit

Permalink
Merge pull request #67 from DeveloperAcademy-POSTECH/feat/#43
Browse files Browse the repository at this point in the history
feat#43 / 온보딩 퍼스트 뷰 네비게이션바 간격 수정
  • Loading branch information
sunhaleeRiley authored May 23, 2024
2 parents 8b84e96 + 0118eb8 commit 4aa8910
Show file tree
Hide file tree
Showing 2 changed files with 113 additions and 107 deletions.
217 changes: 110 additions & 107 deletions MC2-Team3-Pilling/View/OnboardingFirstView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,125 +16,128 @@ struct OnboardingFirstView: View {
@State var selectedTakingDays = 4

var body: some View {
Image("onboardingFirst")
//.resizable()
//.frame(width: 240, height: 240)


// Text
HStack {
VStack(alignment: .leading) {
Text("복용하고 계신 약을 알려주세요!")
.largeBold()
.padding(.bottom, 2)

Text("설정은 추후에 변경 가능합니다.")
.secondaryRegular()
}
Spacer()
}
.padding()


// Selecting box
VStack {
Button(action: {
self.showingMedicineSheet = true
}, label: {
// sfSymbol 부재 : medicine-bottle-one
HStack {
Image(systemName: "pill.circle.fill")
Text("약 종류")
VStack{
Rectangle()
.background(Color.white)
.frame(height: 30)
.foregroundColor(.white)
Image("onboardingFirst")


// Text
HStack {
VStack(alignment: .leading) {
Text("복용하고 계신 약을 알려주세요!")
.largeBold()
.padding(.bottom, 2)

Text("설정은 추후에 변경 가능합니다.")
.secondaryRegular()
Spacer()

// Optional 해결방법
if let selectedPill = selectedPill{
Text(selectedPill.pillName)
}

Image(systemName: "chevron.right")
}
.padding([.leading, .trailing], 25)
})
.padding(.vertical, 20)
.frame(maxWidth: .infinity)
.background(.customGray02)
.clipShape(RoundedRectangle(cornerRadius: 10))
.foregroundColor(.secondary)
.padding([.leading, .trailing], 16)
.sheet(isPresented: $showingMedicineSheet){
MedicineSheetView(showingMedicineSheet: $showingMedicineSheet, selectedPill: $selectedPill)
.presentationDetents([.medium])
Spacer()
}
.padding()



Button(action: {}, label: {
// sfSymbol 부재 : uis-calender
// Selecting box
VStack {
Button(action: {
self.showingMedicineSheet = true
}, label: {
// sfSymbol 부재 : medicine-bottle-one
HStack {
Image(systemName: "pill.circle.fill")
Text("약 종류")
.secondaryRegular()
Spacer()

// Optional 해결방법
if let selectedPill = selectedPill{
Text(selectedPill.pillName)
}

Image(systemName: "chevron.right")
}
.padding([.leading, .trailing], 25)
})
.padding(.vertical, 20)
.frame(maxWidth: .infinity)
.background(.customGray02)
.clipShape(RoundedRectangle(cornerRadius: 10))
.foregroundColor(.secondary)
.padding([.leading, .trailing], 16)
.sheet(isPresented: $showingMedicineSheet){
MedicineSheetView(showingMedicineSheet: $showingMedicineSheet, selectedPill: $selectedPill)
.presentationDetents([.medium])
}

HStack {
Image(systemName: "note")
Text("현재 복용 일수")
.secondaryRegular()
Spacer()


Button(action: {}, label: {
// sfSymbol 부재 : uis-calender

// Picker
Picker("", selection: $selectedTakingDays) {
ForEach(1 ..< 28) { num in
Text("\(num)")
HStack {
Image(systemName: "note")
Text("현재 복용 일수")
.secondaryRegular()
Spacer()

// Picker
Picker("", selection: $selectedTakingDays) {
ForEach(1 ..< 28) { num in
Text("\(num)")
}
}
.pickerStyle(.menu)
.padding(-10)
.accentColor(Color.secondary)

Text("일 차")

}
.pickerStyle(.menu)
.padding(-10)
.accentColor(Color.secondary)

Text("일 차")

}
.padding([.leading, .trailing], 25)
})
.padding(.vertical, 20)
.frame(maxWidth: .infinity)
.background(.customGray02)
.clipShape(RoundedRectangle(cornerRadius: 10))
.foregroundColor(.secondary)
.padding([.leading, .trailing], 16)

}

Spacer()

VStack {
// footer button
Button(action: {
pillInfo = Config.dummyPillInfos[1]
print("pillInfo.pillName:\(pillInfo.placeboDay)")
selectedTakingDays = 5
isActive = true // 네비게이션 링크를 활성화
.padding([.leading, .trailing], 25)
})
.padding(.vertical, 20)
.frame(maxWidth: .infinity)
.background(.customGray02)
.clipShape(RoundedRectangle(cornerRadius: 10))
.foregroundColor(.secondary)
.padding([.leading, .trailing], 16)

}, label: {
Text("다음으로")
.largeBold()
})
.padding(.vertical, 25)
.frame(maxWidth: .infinity)
.background(selectedPill == nil ? Color.customGray : Color.customGreen)
.clipShape(RoundedRectangle(cornerRadius: 20))
.foregroundColor(.black)
.padding()
.disabled(selectedPill == nil)
}

// 버튼과 네비게이션링크를 같이 띄우는 방법?
Spacer()

NavigationLink(
destination: OnboardingSecondView(pillInfo: $selectedPill, intakeDay: $selectedTakingDays),
isActive: $isActive,
label: {
EmptyView() // 보이지 않게 설정
}
)
VStack {
// footer button
Button(action: {
pillInfo = Config.dummyPillInfos[1]
print("pillInfo.pillName:\(pillInfo.placeboDay)")
selectedTakingDays = 5
isActive = true // 네비게이션 링크를 활성화

}, label: {
Text("다음으로")
.largeBold()
})
.padding(.vertical, 25)
.frame(maxWidth: .infinity)
.background(selectedPill == nil ? Color.customGray : Color.customGreen)
.clipShape(RoundedRectangle(cornerRadius: 20))
.foregroundColor(.black)
.padding()
.disabled(selectedPill == nil)

// 버튼과 네비게이션링크를 같이 띄우는 방법?

NavigationLink(
destination: OnboardingSecondView(pillInfo: $selectedPill, intakeDay: $selectedTakingDays),
isActive: $isActive,
label: {
EmptyView() // 보이지 않게 설정
}
)
}
}
}

}
3 changes: 3 additions & 0 deletions MC2-Team3-Pilling/View/OnboardingSecondView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,16 @@ struct OnboardingSecondView: View {
@Query var user:[UserInfo]

var body: some View {


NavigationStack{
if !isActive {
VStack{
Image("onboardingSecond")
//.resizable()
//.frame(width: 240, height: 240)


// Text
HStack {
VStack(alignment: .leading) {
Expand Down

0 comments on commit 4aa8910

Please sign in to comment.