-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
23367ac
commit e5f0740
Showing
4 changed files
with
147 additions
and
77 deletions.
There are no files selected for viewing
21 changes: 21 additions & 0 deletions
21
PingPong/Projects/Core/Domain/Model/Sources/Model/Profile/WithDraw/DropdownItem.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// | ||
// DropdownItem.swift | ||
// Model | ||
// | ||
// Created by Byeon jinha on 11/18/23. | ||
// Copyright © 2023 Wonji Suh. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
|
||
public struct DropdownItem: Identifiable { | ||
public let id: Int | ||
public let title: String | ||
public let onSelect: () -> Void | ||
|
||
public init(id: Int, title: String, onSelect: @escaping () -> Void) { | ||
self.id = id | ||
self.title = title | ||
self.onSelect = onSelect | ||
} | ||
} |
65 changes: 65 additions & 0 deletions
65
PingPong/Projects/Feature/Profile/Sources/UI/View/WithDraw/Dropdown/CustomDropdownMenu.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
// | ||
// CustomDropdownMenu.swift | ||
// Profile | ||
// | ||
// Created by Byeon jinha on 11/18/23. | ||
// Copyright © 2023 Wonji Suh. All rights reserved. | ||
// | ||
|
||
import Common | ||
import DesignSystem | ||
import Model | ||
import Authorization | ||
import SwiftUI | ||
|
||
|
||
struct CustomDropdownMenu: View { | ||
@State var isSelecting = false | ||
@State var selectionTitle = "이런 점이 불편했어요." | ||
@State var selectedRowId = 0 | ||
|
||
var body: some View { | ||
VStack { | ||
HStack { | ||
VStack { | ||
HStack { | ||
Text(isSelecting ? "선택해주세요." : selectionTitle) | ||
.pretendardFont(family: .Medium, size: 16) | ||
.foregroundColor(isSelecting ? .basicGray5 : .basicGray7) | ||
.padding(EdgeInsets(top: 12, leading: 16, bottom: 12, trailing: 0)) | ||
Spacer() | ||
VStack { | ||
Image(systemName: isSelecting ? "chevron.up" : "chevron.down") | ||
.foregroundColor(.basicGray8) | ||
.padding(16) | ||
Spacer() | ||
} | ||
} | ||
if isSelecting { | ||
|
||
VStack(spacing: 0) { | ||
DropdownMenuItemView(isSelecting: $isSelecting, selectiontitle: $selectionTitle, selectionId: $selectedRowId, item: .init(id: 1, title: "서비스 이용이 불편해요.", onSelect: {})) | ||
DropdownMenuItemView(isSelecting: $isSelecting, selectiontitle: $selectionTitle, selectionId: $selectedRowId, item: .init(id: 2, title: "명언이 마음에 들지 않아요.", onSelect: {})) | ||
DropdownMenuItemView(isSelecting: $isSelecting, selectiontitle: $selectionTitle, selectionId: $selectedRowId, item: .init(id: 3, title: "비슷한 서비스 앱이 더 좋아요.", onSelect: {})) | ||
DropdownMenuItemView(isSelecting: $isSelecting, selectiontitle: $selectionTitle, selectionId: $selectedRowId, item: .init(id: 3, title: "자주 사용하지 않아요.", onSelect: {})) | ||
} | ||
} | ||
} | ||
} | ||
.frame(width: UIScreen.screenWidth - 40, height: isSelecting ? 240 : 48) | ||
.overlay( | ||
RoundedRectangle(cornerRadius: 8) | ||
.stroke(lineWidth: 1) | ||
.foregroundColor(.basicGray4) | ||
) | ||
.padding(EdgeInsets(top: 12, leading: 20, bottom: 12, trailing: 20)) | ||
} | ||
.frame(maxWidth: .infinity) | ||
.padding(.vertical) | ||
.cornerRadius(5) | ||
.onTapGesture { | ||
isSelecting.toggle() | ||
} | ||
} | ||
|
||
} |
39 changes: 39 additions & 0 deletions
39
...ong/Projects/Feature/Profile/Sources/UI/View/WithDraw/Dropdown/DropdownMenuItemView.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// | ||
// DropdownMenuItemView.swift | ||
// Profile | ||
// | ||
// Created by Byeon jinha on 11/18/23. | ||
// Copyright © 2023 Wonji Suh. All rights reserved. | ||
// | ||
|
||
import Common | ||
import DesignSystem | ||
import Model | ||
import Authorization | ||
import SwiftUI | ||
|
||
struct DropdownMenuItemView: View { | ||
@Binding var isSelecting: Bool | ||
@Binding var selectiontitle: String | ||
@Binding var selectionId: Int | ||
|
||
let item: DropdownItem | ||
|
||
var body: some View { | ||
Button(action: { | ||
isSelecting = false | ||
selectiontitle = item.title | ||
item.onSelect() | ||
}) { | ||
HStack { | ||
Text(item.title) | ||
.foregroundColor(.basicGray9) | ||
.pretendardFont(family: .Medium, size: 16) | ||
.padding(.leading, 16) | ||
|
||
Spacer() | ||
} | ||
.frame(width: UIScreen.screenWidth - 40, height: 48) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters