forked from AcaMate/AcaMate_iOS
82 lines
3.2 KiB
Swift
82 lines
3.2 KiB
Swift
//
|
|
// MainView.swift
|
|
// AcaMate
|
|
//
|
|
// Created by TAnine on 2/4/25.
|
|
//
|
|
|
|
import SwiftUI
|
|
import Combine
|
|
|
|
struct MainView: View {
|
|
@EnvironmentObject var alertController: AlertController
|
|
@State var cancellables: Set<AnyCancellable> = []
|
|
@Binding var naviState : NaviState
|
|
|
|
@State private var scrollOffset: CGPoint = .zero
|
|
@State private var topViewState: Bool = false
|
|
|
|
var body: some View {
|
|
VStack(spacing: 0) {
|
|
ZStack {
|
|
OffsetObservableScrollView(scrollOffset: $scrollOffset) { proxy in
|
|
VStack(spacing: 0) {
|
|
TopProfileView()
|
|
.padding(EdgeInsets(top: 0, leading: 0, bottom: 12, trailing: 0))
|
|
AttendanceBoxView()
|
|
.background {
|
|
RoundedRectangle(cornerRadius: 8)
|
|
.foregroundStyle(Color(.Other.cell))
|
|
}
|
|
.padding(EdgeInsets(top: 12, leading: 24, bottom: 12, trailing: 24))
|
|
AttendanceBoxView()
|
|
.background {
|
|
RoundedRectangle(cornerRadius: 8)
|
|
.foregroundStyle(Color(.Other.cell))
|
|
}
|
|
.padding(EdgeInsets(top: 12, leading: 24, bottom: 12, trailing: 24))
|
|
AttendanceBoxView()
|
|
.background {
|
|
RoundedRectangle(cornerRadius: 8)
|
|
.foregroundStyle(Color(.Other.cell))
|
|
}
|
|
.padding(EdgeInsets(top: 12, leading: 24, bottom: 12, trailing: 24))
|
|
CalendarBoxView(summaryCalDataList: [
|
|
SummaryCalendar(id: "123", date: "2025-02-28", summary: "요약내용입니다."),
|
|
SummaryCalendar(id: "123", date: "2025-02-28", summary: "요약내용입니다.")])
|
|
|
|
.background {
|
|
RoundedRectangle(cornerRadius: 8)
|
|
.foregroundStyle(Color(.Other.cell))
|
|
}
|
|
.padding(EdgeInsets(top: 12, leading: 24, bottom: 12, trailing: 24))
|
|
}
|
|
}
|
|
|
|
if topViewState {
|
|
VStack(spacing: 0) {
|
|
TopView(titleName: "Name")
|
|
.transition(.move(edge: .top))
|
|
.animation(.easeInOut, value: scrollOffset)
|
|
Spacer(minLength: 1)
|
|
}
|
|
|
|
|
|
|
|
}
|
|
}
|
|
BottomView()
|
|
.frame(maxWidth: .infinity)
|
|
}
|
|
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
|
.onChange(of: scrollOffset.y) { oldValue, newValue in
|
|
if newValue > 200 && topViewState == false {
|
|
topViewState = true
|
|
} else if newValue < 20 && topViewState == true{
|
|
topViewState = false
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|