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

[Feat/#62] 퀴즈 풀기 화면 수정 #63

Merged
merged 10 commits into from
Nov 21, 2023
Prev Previous commit
Next Next commit
feat: 퀴즈 풀이 뷰 수정
mooyoung2309 committed Nov 20, 2023
commit 4c3b3edc55563977ad49912b750d3dd5f1b96852
Original file line number Diff line number Diff line change
@@ -11,67 +11,6 @@ import SwiftUI

import ComposableArchitecture

struct QuizChoiceButton: View {
let choice: String
let answer: Int
let userAnswer: Int?
var action: () -> ()

@State var isPressed: Bool = false

init(
choice: String,
answer: Int,
userAnswer: Int? = nil,
isPressed: Bool = false,
action: @escaping () -> ()
) {
self.choice = choice
self.answer = answer
self.userAnswer = userAnswer
self.isPressed = isPressed
self.action = action
}

var body: some View {
Button(action: {
action()
}, label: {
HStack {
Spacer()
Text(choice)
.fontWeight(.semibold)
Spacer()
}
})
.buttonStyle(
ScrollViewGestureButtonStyle(
pressAction: {
withAnimation {
isPressed = true
}
},
doubleTapTimeoutout: 1,
doubleTapAction: {
},
longPressTime: 0,
longPressAction: {
},
endAction: {
withAnimation {
isPressed = false
}
}
)
)
.padding(10)
.background(isPressed ? Color.systemGray6 : Color.background)
.cornerRadius(20)
.clipped()
.scaleEffect(isPressed ? 0.95 : 1)
}
}

public struct QuizListItemCellView: View {
let store: StoreOf<QuizListItemCellStore>

@@ -81,12 +20,17 @@ public struct QuizListItemCellView: View {

public var body: some View {
WithViewStore(self.store, observe: { $0 }) { viewStore in
VStack(spacing: 15) {
VStack {
Text(viewStore.state.question)
.padding(.top, 40)

Spacer()

ForEach(Array(viewStore.choices.enumerated()), id: \.offset) { index, choice in
D3NIconAnimationButton(
title: choice
icon: .resolved(index: index),
title: choice,
isSelected: index == viewStore.state.userAnswer
) {

}
8 changes: 4 additions & 4 deletions Targets/D3N/Sources/Shared/DesignSystem/D3NIcon.swift
Original file line number Diff line number Diff line change
@@ -40,8 +40,8 @@ public extension D3NIcon {
}
}

static let one: D3NIcon = .init(systemImageName: "1.circle.fill", color: .black)
static let two: D3NIcon = .init(systemImageName: "2.circle.fill", color: .black)
static let three: D3NIcon = .init(systemImageName: "3.circle.fill", color: .black)
static let four: D3NIcon = .init(systemImageName: "4.circle.fill", color: .black)
static let one: D3NIcon = .init(systemImageName: "1.circle.fill", color: .pink)
static let two: D3NIcon = .init(systemImageName: "2.circle.fill", color: .mint)
static let three: D3NIcon = .init(systemImageName: "3.circle.fill", color: .orange)
static let four: D3NIcon = .init(systemImageName: "4.circle.fill", color: .purple)
}
Original file line number Diff line number Diff line change
@@ -22,7 +22,7 @@ public struct D3NProgressBar: View {
currentIndex: Int = 0
) {
self.items = items
self.currentIndex = 0
self.currentIndex = currentIndex
}

public var body: some View {