12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
//
// ContentView.swift
// Calcura+e
//
// Created by Nursultan Yelemessov on 12/11/2021.
//
import SwiftUI
struct ProfileHeaderView: View {
let name: String
let themeProvider: ThemeProvider
var onEdit: () -> Void = {}
var body: some View {
HStack(spacing: 12) {
Image("speed_and_shine_icon")
.resizable()
.scaledToFit()
.frame(width: 128, height: 128)
HStack(spacing: 4) {
Text(name.isEmpty ? "User" : name)
.font(.typography(size: 18, weight: .semibold))
.foregroundStyle(.white)
Spacer()
Image(systemName: "chevron.right")
.resizable()
.scaledToFit()
.frame(width: 15, height: 15)
}
.frame(maxWidth: .infinity, alignment: .leading)
}
.padding(.horizontal, 16)
.frame(maxWidth: .infinity, alignment: .leading)
.frame(height: 72)
.glassEffect(.regular.tint(.black.opacity(0.45)), in: .rect(cornerRadius: 16))
.overlay {
RoundedRectangle(cornerRadius: 16)
.stroke(Color.white.opacity(0.1), lineWidth: 1)
}
.background {
RoundedRectangle(cornerRadius: 16)
.fill(themeProvider.theme.glassBackground)
}
.onTapGesture {
onEdit()
}
}
}