Skip to content

Commit 8ff327d

Browse files
committed
chore: revert openedx#332 PR
1 parent a78d4e6 commit 8ff327d

File tree

1 file changed

+61
-75
lines changed

1 file changed

+61
-75
lines changed

Profile/Profile/Presentation/EditProfile/ProfileBottomSheet.swift

+61-75
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,6 @@ struct ProfileBottomSheet: View {
4141

4242
@Environment (\.isHorizontal) private var isHorizontal
4343

44-
private var maxWidth: CGFloat {
45-
idiom == .pad || (idiom == .phone && isHorizontal) ? 330 : .infinity
46-
}
47-
4844
init(
4945
showingBottomSheet: Binding<Bool>,
5046
openGallery: @escaping () -> Void,
@@ -56,84 +52,74 @@ struct ProfileBottomSheet: View {
5652
}
5753

5854
var body: some View {
59-
GeometryReader { proxy in
60-
ZStack(alignment: .bottom) {
61-
if showingBottomSheet {
62-
background
63-
.onTapGesture {
64-
withAnimation {
65-
showingBottomSheet = false
66-
}
55+
ZStack(alignment: .bottom) {
56+
if showingBottomSheet {
57+
Color.black.opacity(0.5)
58+
.ignoresSafeArea()
59+
.onTapGesture {
60+
withAnimation {
61+
showingBottomSheet = false
6762
}
68-
}
69-
content
70-
.offset(y: showingBottomSheet ? yPosition : proxy.size.height)
71-
.gesture(dragGesture)
63+
}
7264
}
73-
.frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .center)
74-
}
75-
}
76-
77-
private var background: some View {
78-
Color.black
79-
.opacity(0.5)
80-
.ignoresSafeArea()
81-
}
82-
83-
private var content: some View {
84-
VStack {
8565
VStack {
86-
VStack(alignment: .center, spacing: 4) {
87-
HStack(alignment: .center) {
88-
RoundedRectangle(cornerRadius: 2, style: .circular)
89-
.foregroundColor(Theme.Colors.textSecondary)
90-
.frame(width: 31, height: 4)
91-
.padding(.top, 4)
92-
}
93-
.frame(maxWidth: .infinity)
94-
95-
Text(ProfileLocalization.Edit.BottomSheet.title)
96-
.font(Theme.Fonts.titleLarge)
97-
.frame(maxWidth: .infinity, alignment: .leading)
98-
.padding(.vertical, 14)
99-
.accessibilityIdentifier("profile_bottom_sheet_title_text")
100-
101-
button(title: ProfileLocalization.Edit.BottomSheet.select,
102-
type: .gallery,
103-
action: {
104-
openGallery()
105-
})
106-
.accessibilityIdentifier("select_picture_button")
107-
108-
button(title: ProfileLocalization.Edit.BottomSheet.remove,
109-
type: .remove,
110-
action: {
111-
removePhoto()
112-
})
113-
.padding(.top, 10)
114-
.accessibilityIdentifier("remove_picture_button")
66+
VStack {
67+
VStack(alignment: .center, spacing: 4) {
68+
HStack(alignment: .center) {
69+
RoundedRectangle(cornerRadius: 2, style: .circular)
70+
.foregroundColor(Theme.Colors.textSecondary)
71+
.frame(width: 31, height: 4)
72+
.padding(.top, 4)
73+
}.frame(maxWidth: .infinity)
74+
75+
Text(ProfileLocalization.Edit.BottomSheet.title)
76+
.font(Theme.Fonts.titleLarge)
77+
.frame(maxWidth: .infinity, alignment: .leading)
78+
.padding(.vertical, 14)
79+
.accessibilityIdentifier("profile_bottom_sheet_title_text")
80+
81+
button(title: ProfileLocalization.Edit.BottomSheet.select,
82+
type: .gallery,
83+
action: {
84+
openGallery()
85+
})
86+
.accessibilityIdentifier("select_picture_button")
87+
88+
button(title: ProfileLocalization.Edit.BottomSheet.remove,
89+
type: .remove,
90+
action: {
91+
removePhoto()
92+
})
93+
.padding(.top, 10)
94+
.accessibilityIdentifier("remove_picture_button")
95+
96+
button(title: ProfileLocalization.Edit.BottomSheet.cancel,
97+
type: .cancel,
98+
action: {
99+
withAnimation {
100+
showingBottomSheet = false
101+
}
102+
})
103+
.padding(.top, 34)
104+
.accessibilityIdentifier("cancel_button")
105+
}.padding(.horizontal, 24)
115106

116-
button(title: ProfileLocalization.Edit.BottomSheet.cancel,
117-
type: .cancel,
118-
action: {
119-
withAnimation {
120-
showingBottomSheet = false
121-
}
122-
})
123-
.padding(.top, 34)
124-
.accessibilityIdentifier("cancel_button")
125107
}
126-
.padding(.horizontal, 24)
108+
.frame(minWidth: 0,
109+
maxWidth: (idiom == .pad || (idiom == .phone && isHorizontal))
110+
? 330
111+
: .infinity,
112+
maxHeight: 290, alignment: .topLeading)
113+
.background(Theme.Colors.cardViewBackground)
114+
.cornerRadius(8)
115+
.padding(.horizontal, 22)
127116
}
128-
.frame(minWidth: 0,
129-
maxWidth: maxWidth,
130-
maxHeight: 290, alignment: .topLeading)
131-
.background(Theme.Colors.cardViewBackground)
132-
.cornerRadius(8)
133-
.padding(.horizontal, 22)
134-
}
117+
.offset(y: showingBottomSheet ? yPosition : 700)
118+
.gesture(dragGesture)
119+
}.frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .center)
135120
}
136-
121+
122+
@ViewBuilder
137123
private func button(title: String, type: ButtonType, action: @escaping () -> Void) -> some View {
138124
Button(action: action) {
139125
HStack(alignment: .center) {

0 commit comments

Comments
 (0)