import SwiftUI

struct PolicyView: View {
    var policyPage: PolicyPage
    
    @State private var bodyHeight: CGFloat = 0
    
    var body: some View {
        ScrollViewWithBanner { _ in
            HTMLView(dynamicHeight: $bodyHeight, html: policyPage.post.content.rendered, assets: policyPage.post.webAssets)
                .frame(height: bodyHeight)
                .opacity(bodyHeight == 0 ? 0 : 1)
                .padding(.horizontal, 16)
        }
        .navigationTitle(policyPage.navigationTitle)
    }
}
