burger menu profile scroll

This commit is contained in:
cheykrym 2025-08-14 03:12:32 +03:00
parent 58e3488a9d
commit 1fdc8dbf45

View File

@ -3,61 +3,71 @@ import SwiftUI
struct SideMenuView: View {
@Binding var isPresented: Bool
// Adjustable paddings
private let topPadding: CGFloat = 66
private let bottomPadding: CGFloat = 34
var body: some View {
VStack(alignment: .leading, spacing: 0) {
// Header
VStack(alignment: .leading) {
Image(systemName: "person.circle.fill")
.resizable()
.frame(width: 60, height: 60)
.foregroundColor(.gray)
Text("Your Name")
.font(.title2).bold()
Text("@yourusername")
.font(.subheadline)
.foregroundColor(.secondary)
}
.padding(20)
// Menu Items
ScrollView {
VStack(alignment: .leading, spacing: 20) {
// Section 1
VStack(alignment: .leading, spacing: 15) {
SideMenuButton(icon: "person.2.fill", title: "People You May Like", action: {})
SideMenuButton(icon: "star.fill", title: "Fun Fest", action: {})
SideMenuButton(icon: "lightbulb.fill", title: "Creator Center", action: {})
VStack(alignment: .leading, spacing: 0) { // Parent VStack
// Header
VStack(alignment: .leading) {
Image(systemName: "person.circle.fill")
.resizable()
.frame(width: 60, height: 60)
.foregroundColor(.gray)
Text("Your Name")
.font(.title2).bold()
Text("@yourusername")
.font(.subheadline)
.foregroundColor(.secondary)
}
.padding(.horizontal, 20)
.padding(.top, topPadding)
.padding(.bottom, 20)
Divider()
// Section 2
VStack(alignment: .leading, spacing: 15) {
Text("CATEGORY").font(.caption).foregroundColor(.secondary)
SideMenuButton(icon: "doc.text", title: "Drafts", action: {})
SideMenuButton(icon: "bubble.left", title: "My Comments", action: {})
SideMenuButton(icon: "clock", title: "History", action: {})
SideMenuButton(icon: "arrow.down.circle", title: "My Downloads", action: {})
}
Divider()
// Section 3
VStack(alignment: .leading, spacing: 15) {
Text("SERVICES").font(.caption).foregroundColor(.secondary)
SideMenuButton(icon: "shippingbox", title: "Orders", action: {})
SideMenuButton(icon: "cart", title: "Cart", action: {})
SideMenuButton(icon: "wallet.pass", title: "Wallet", action: {})
}
Divider()
// Section 4
VStack(alignment: .leading, spacing: 15) {
SideMenuButton(icon: "square.grid.2x2", title: "Applets", action: {})
// Menu Items
VStack(alignment: .leading, spacing: 20) {
// Section 1
VStack(alignment: .leading, spacing: 15) {
SideMenuButton(icon: "person.2.fill", title: "People You May Like", action: {})
SideMenuButton(icon: "star.fill", title: "Fun Fest", action: {})
SideMenuButton(icon: "lightbulb.fill", title: "Creator Center", action: {})
}
Divider()
// Section 2
VStack(alignment: .leading, spacing: 15) {
Text("CATEGORY").font(.caption).foregroundColor(.secondary)
SideMenuButton(icon: "doc.text", title: "Drafts", action: {})
SideMenuButton(icon: "bubble.left", title: "My Comments", action: {})
SideMenuButton(icon: "clock", title: "History", action: {})
SideMenuButton(icon: "arrow.down.circle", title: "My Downloads", action: {})
}
Divider()
// Section 3
VStack(alignment: .leading, spacing: 15) {
Text("SERVICES").font(.caption).foregroundColor(.secondary)
SideMenuButton(icon: "shippingbox", title: "Orders", action: {})
SideMenuButton(icon: "cart", title: "Cart", action: {})
SideMenuButton(icon: "wallet.pass", title: "Wallet", action: {})
}
Divider()
// Section 4
VStack(alignment: .leading, spacing: 15) {
SideMenuButton(icon: "square.grid.2x2", title: "Applets", action: {})
}
}
.padding()
}
.padding()
.frame(maxWidth: .infinity, alignment: .leading) // Align to the left
}
Spacer()
@ -71,6 +81,7 @@ struct SideMenuView: View {
Spacer()
}
.padding()
.padding(.bottom, bottomPadding)
}
.background(Color(UIColor.systemBackground))
}