diff --git a/MC2-Team3-Pilling/View/OnboardingFirstView.swift b/MC2-Team3-Pilling/View/OnboardingFirstView.swift index aa6f5f2..9638c50 100644 --- a/MC2-Team3-Pilling/View/OnboardingFirstView.swift +++ b/MC2-Team3-Pilling/View/OnboardingFirstView.swift @@ -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() // 보이지 않게 설정 + } + ) + } } } - } diff --git a/MC2-Team3-Pilling/View/OnboardingSecondView.swift b/MC2-Team3-Pilling/View/OnboardingSecondView.swift index 35e0744..ebbcf68 100644 --- a/MC2-Team3-Pilling/View/OnboardingSecondView.swift +++ b/MC2-Team3-Pilling/View/OnboardingSecondView.swift @@ -17,6 +17,8 @@ struct OnboardingSecondView: View { @Query var user:[UserInfo] var body: some View { + + NavigationStack{ if !isActive { VStack{ @@ -24,6 +26,7 @@ struct OnboardingSecondView: View { //.resizable() //.frame(width: 240, height: 240) + // Text HStack { VStack(alignment: .leading) {