0% found this document useful (0 votes)
4 views4 pages

OneMark 4

The document defines a SwiftUI view called SectionBannerView, which displays a banner based on the state of a section. It utilizes a ViewModel to manage the view's state and presents different content based on whether the section is hidden, showing details, or displaying additional images. The view includes a title, instructions, and an action button, all styled with branding colors and spacing.

Uploaded by

avecutsav3
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as RTF, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views4 pages

OneMark 4

The document defines a SwiftUI view called SectionBannerView, which displays a banner based on the state of a section. It utilizes a ViewModel to manage the view's state and presents different content based on whether the section is hidden, showing details, or displaying additional images. The view includes a title, instructions, and an action button, all styled with branding colors and spacing.

Uploaded by

avecutsav3
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as RTF, PDF, TXT or read online on Scribd
You are on page 1/ 4

import CoreModels

import DependencyManager
import DesignSystem
import GEUI
import SwiftUI

public struct SectionBannerView: View {


@StateObject private var viewModel:
SectionBannerViewModel
@Dependency var branding: BrandingProtocol

)
}

public var body: some View {


bannerView
}

@ViewBuilder
var bannerView: some View {
let viewState =
viewModel.sectionBannerState.viewState

switch viewState {
case .hidden:
EmptyView()

case let .showSection(section):


detailContent(
title: section.name,
instructions: section.instructions
)

case .showAdditionalImages:
detailContent(
title:
Localization.SectionBannerView.AdditionalImages.tit
le,
instructions:
Localization.SectionBannerView.AdditionalImages.in
structions
)
}
}

private func detailContent(


title: String,
instructions: String
) -> some View {
VStack {
HStack(spacing: Spacing.small) {
VStack(spacing: Spacing.default) {
sectionTitle(title)
sectionInstruction(instructions)

Spacer(minLength: 0)
}
Spacer(minLength: 0)
startSectionActionButton
}
.padding(.vertical, Padding.vLarge)
.padding(.horizontal, Padding.default)
Spacer(minLength: 0)
}
.padding(.horizontal, Padding.default)
.padding(.vertical, Padding.small)

.background(branding.colors.background.secondar
y)
.foregroundColor(Asset.GEColors.airBase.swiftUICol
or)
}

private func sectionTitle(


_ title: String
) -> some View {
HStack {
Text(title)
.font(.titlePrimary())
Spacer(minLength: 0)
}
}

private func sectionInstruction(


_ instructions: String
) -> some View {
HStack {
Text(instructions)
.font(.titleTertiary())
.lineSpacing(Spacing.small)
Spacer(minLength: 0)
}
}

@ViewBuilder
private var startSectionActionButton: some View
{
VStack {
GEIconWithTextButton(
isDisabled: false,
image:
Asset.Icons.skipNext.swiftUIImage,
text:
Localization.Button.startSection,
colors: .whiteOutlineButton,
iconPosition: .right,
contentPadding: Padding.default,
action: {
}
)
}
}
}

You might also like