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

OneMark 3

The document defines a SwiftUI view called SectionBannerView that displays different content based on the state of a section banner. It uses a ViewModel to manage the state and presents either an empty view, section details, or additional images. The view includes a title, instructions, and a button for starting the section, with styling applied from a branding protocol.

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)
5 views4 pages

OneMark 3

The document defines a SwiftUI view called SectionBannerView that displays different content based on the state of a section banner. It uses a ViewModel to manage the state and presents either an empty view, section details, or additional images. The view includes a title, instructions, and a button for starting the section, with styling applied from a branding protocol.

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:
SectionBan @Dependency var branding:
BrandingProtocol

public init(
viewModel: SectionBannerViewModel
){
}

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