Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
179 commits
Select commit Hold shift + click to select a range
9a48e40
add UKModalController, UKBottomModalController and UKCenterModalContr…
mikhailChelbaev Nov 22, 2024
3962820
regroup files
mikhailChelbaev Nov 22, 2024
9473d95
add base properties to ModalVM
mikhailChelbaev Nov 22, 2024
bbcc1e0
change type of the container to scroll view to avoid truncating conte…
mikhailChelbaev Nov 22, 2024
e8dcf27
fix mistake in naming
mikhailChelbaev Nov 25, 2024
bedfb0a
split modal content into header, body and footer
mikhailChelbaev Nov 25, 2024
838eee7
add `modalPaddings` property to the vm
mikhailChelbaev Nov 25, 2024
32160b1
add modal size property
mikhailChelbaev Nov 25, 2024
0badac1
reorder layout properties
mikhailChelbaev Nov 25, 2024
616606d
add modal corner radius
mikhailChelbaev Nov 25, 2024
8ab57a4
fix invalid content size calculation inside the modal
mikhailChelbaev Nov 25, 2024
99dd4d7
remove `hasCloseButton` from modalVM
mikhailChelbaev Nov 25, 2024
dbf6042
add custom platform agnostic `Paddings` struct
mikhailChelbaev Nov 25, 2024
c7d6e34
fix: return proper color for `secondaryBackground`
mikhailChelbaev Nov 25, 2024
6d7959b
add preview for `UKCenterModalController`
mikhailChelbaev Nov 25, 2024
557449f
add BottomModal preview
mikhailChelbaev Nov 26, 2024
aeafed8
add basic implementation of SUModal
mikhailChelbaev Nov 27, 2024
84fa2ba
add transition animations for swiftui center modal
mikhailChelbaev Nov 27, 2024
307abcb
regroup files
mikhailChelbaev Nov 28, 2024
9d245ba
Merge branch 'modal-uikit' into modal-swiftui
mikhailChelbaev Nov 28, 2024
aefbd26
extract subviews and helpers to separate files
mikhailChelbaev Nov 28, 2024
0ba9bc5
add presentation helpers for SUCenterModal
mikhailChelbaev Nov 28, 2024
cf7a8f0
add bottom modal file
mikhailChelbaev Nov 28, 2024
384083f
extract bottom modal animation params into a separate file
mikhailChelbaev Nov 28, 2024
dd61e55
Merge branch 'modal-uikit' into modal-swiftui
mikhailChelbaev Nov 28, 2024
6531bb1
implement SUBottomModal animation
mikhailChelbaev Nov 28, 2024
62a916f
add modal presentation modifiers to have animation when modals are cl…
mikhailChelbaev Nov 28, 2024
594585d
refactor: modal previews
mikhailChelbaev Nov 29, 2024
296eb83
add `transitionDuration` property to `ModalVM`
mikhailChelbaev Nov 29, 2024
73973dc
Merge branch 'modal-uikit' into modal-swiftui
mikhailChelbaev Nov 29, 2024
c0c45c4
add sumodal previews
mikhailChelbaev Nov 29, 2024
5534029
refactor: add ModalTransition type
mikhailChelbaev Nov 29, 2024
651ccfc
Merge branch 'modal-uikit' into modal-swiftui
mikhailChelbaev Nov 29, 2024
18fa199
remove previews from modals
mikhailChelbaev Nov 29, 2024
2ae40fb
add docs for modal vms
mikhailChelbaev Nov 29, 2024
8e5f60e
replace `opaque` overlay with `transparent`
mikhailChelbaev Nov 29, 2024
894f999
add docs for other models related to modal
mikhailChelbaev Nov 29, 2024
0f446e1
add docs for modal vms
mikhailChelbaev Nov 29, 2024
5cd2fe2
add docs for modal controllers
mikhailChelbaev Nov 29, 2024
c661a60
fix: rename picker param
mikhailChelbaev Nov 29, 2024
ce07794
Merge branch 'modal-uikit' into modal-swiftui
mikhailChelbaev Nov 29, 2024
82e3e23
add docs for center and bottom modal modifiers
mikhailChelbaev Nov 29, 2024
0a66a09
fix: align modal content to the leading corner
mikhailChelbaev Nov 29, 2024
95b9f9a
add examples to the docs
mikhailChelbaev Nov 29, 2024
1a11bc8
improve helper for uikit components preview
mikhailChelbaev Dec 4, 2024
3ffd63f
use `Button` instead of `Text` in `SUButton` implementation
mikhailChelbaev Dec 5, 2024
4a181e0
SUCountdown
VislovIvan Dec 8, 2024
77a2135
Localization
VislovIvan Dec 9, 2024
4af06c6
Some fix
VislovIvan Dec 9, 2024
cc435ef
Docs and Localization fix
VislovIvan Dec 9, 2024
4f18c59
pr fix
VislovIvan Dec 10, 2024
31b592e
remove SwiftLintPlugins
mikhailChelbaev Dec 10, 2024
e688727
add swiftlint in github actions
mikhailChelbaev Dec 10, 2024
8d34cb7
fix: add a step that installs swiftlint
mikhailChelbaev Dec 10, 2024
198a8f9
update code that installs swiftlint
mikhailChelbaev Dec 10, 2024
4bfe91f
update code for github swiftlint action
mikhailChelbaev Dec 10, 2024
0bc94b9
exclude Examples folder from linting
mikhailChelbaev Dec 10, 2024
bf088b4
remove extra steps in github actions
mikhailChelbaev Dec 10, 2024
642751f
Merge pull request #33 from componentskit/github-actions
mikhailChelbaev Dec 10, 2024
4986894
add privacy manifest
mikhailChelbaev Dec 10, 2024
beae296
Merge pull request #34 from componentskit/privacy-manifest
mikhailChelbaev Dec 10, 2024
dd421c7
Merge branch 'dev' into refactor
mikhailChelbaev Dec 10, 2024
3e5f06c
resolve todo
mikhailChelbaev Dec 10, 2024
9dc0739
change scope of models' helpers
mikhailChelbaev Dec 10, 2024
7fc759c
fix: do not execute action if the touch was cancelled
mikhailChelbaev Dec 10, 2024
2fa9496
fix InputField and TextInput previews
mikhailChelbaev Dec 10, 2024
45998ef
Merge pull request #31 from componentskit/refactor
mikhailChelbaev Dec 11, 2024
8260ebc
move config related files to a separate folder
mikhailChelbaev Dec 11, 2024
01592e5
Fix localization
VislovIvan Dec 11, 2024
1e3b5a2
refactor SUCountdown
VislovIvan Dec 11, 2024
8009cae
removed associated values
VislovIvan Dec 12, 2024
99038f8
localization fix
VislovIvan Dec 12, 2024
70caad0
removed unused code
VislovIvan Dec 12, 2024
532ed5f
minor fix and docs
VislovIvan Dec 12, 2024
be87586
CountdownHelpers
VislovIvan Dec 12, 2024
52f547b
layout refactor
VislovIvan Dec 12, 2024
29eecdf
calculateMaxWidth
VislovIvan Dec 15, 2024
df990f6
calculateWidth
VislovIvan Dec 16, 2024
a8b6a93
bug fix
VislovIvan Dec 16, 2024
a05fe2c
fix countdown foreground color and width + refactor
mikhailChelbaev Dec 17, 2024
7fb95c7
refactor: move a method for calculating time width to the model
mikhailChelbaev Dec 17, 2024
ece0bc5
Merge branch 'dev' into SUCountdown
mikhailChelbaev Dec 17, 2024
04c51b6
add spacing param to the model and rename `unitsPosition` to `unitsSt…
mikhailChelbaev Dec 17, 2024
1d9d3f3
fix: handle trait changes in radio group item to update the border color
mikhailChelbaev Dec 17, 2024
55444b6
refactor: update colors in the Palette
mikhailChelbaev Dec 17, 2024
3b60f68
update size values for button, input field and segmented control
mikhailChelbaev Dec 18, 2024
f822743
add headline, body and button font sets in the cofig
mikhailChelbaev Dec 18, 2024
3d453a2
update size of checkbox
mikhailChelbaev Dec 18, 2024
399ad68
UKCountdown
VislovIvan Dec 19, 2024
c6fa757
swiftlint fix
VislovIvan Dec 19, 2024
5796de3
improve implementation of UKCountdown
mikhailChelbaev Dec 19, 2024
623615e
merge with origin UKCountdown
mikhailChelbaev Dec 19, 2024
440c477
pin stack view to superview edges
mikhailChelbaev Dec 19, 2024
885febe
docs and func shouldUpdateHeight
VislovIvan Dec 20, 2024
2690486
add docs for `UnitsLocalization`
mikhailChelbaev Dec 20, 2024
78baf60
update constraints in `UKCountdown`
mikhailChelbaev Dec 20, 2024
26b1ec1
Merge pull request #35 from componentskit/UKCountdown
mikhailChelbaev Dec 20, 2024
e7470b4
Merge pull request #32 from componentskit/SUCountdown
mikhailChelbaev Dec 20, 2024
8c13e0f
update component colors
mikhailChelbaev Dec 20, 2024
b10de5e
add light button style
mikhailChelbaev Dec 20, 2024
2c12285
move gradient colors to the same file
mikhailChelbaev Dec 20, 2024
7dcfe8e
Merge branch 'dev' into refactor/config
mikhailChelbaev Dec 20, 2024
84ed5e8
add `caption` font size and update fonts in countdown
mikhailChelbaev Dec 20, 2024
4837205
add docs
mikhailChelbaev Dec 20, 2024
88d41c0
regroup files
mikhailChelbaev Dec 20, 2024
7b38711
add docs for config types
mikhailChelbaev Dec 20, 2024
8c44179
add docs for shared types
mikhailChelbaev Dec 20, 2024
3394c1d
put Layout and Palette inside Config
mikhailChelbaev Dec 20, 2024
4ce526b
update readme
mikhailChelbaev Dec 20, 2024
18ef392
adapt demos and fix previews
mikhailChelbaev Dec 20, 2024
1168a96
update custom fonts in the preview
mikhailChelbaev Dec 20, 2024
fe30575
merge with refactor/config
mikhailChelbaev Dec 20, 2024
29af48e
merge with modal-uikit
mikhailChelbaev Dec 20, 2024
bf0773e
Merge branch 'refactor/config' into button/light-style
mikhailChelbaev Dec 20, 2024
7b406ef
remove `colorScheme` param from a method that provides SwiftUI color …
mikhailChelbaev Dec 20, 2024
09a2729
update success and warning colors
mikhailChelbaev Dec 20, 2024
96c8a70
Merge pull request #36 from componentskit/refactor/config
mikhailChelbaev Dec 21, 2024
8f12cc8
Merge pull request #37 from componentskit/button/light-style
mikhailChelbaev Dec 21, 2024
c330916
Merge pull request #38 from componentskit/improve-universal-color
mikhailChelbaev Dec 21, 2024
ba11ff7
Merge pull request #28 from componentskit/modal-uikit
mikhailChelbaev Dec 21, 2024
c36cc69
Merge branch 'dev' into modal-swiftui
mikhailChelbaev Dec 21, 2024
d0d059e
Merge pull request #29 from componentskit/modal-swiftui
mikhailChelbaev Dec 21, 2024
7f20f75
remove `colorScheme` from SUButton and README
mikhailChelbaev Dec 21, 2024
5ae6782
add basic implementation of CardVM and UKCard
mikhailChelbaev Dec 23, 2024
bda0ecb
add background color to card
mikhailChelbaev Dec 23, 2024
088e587
add shadow to config and card
mikhailChelbaev Dec 23, 2024
841c74c
add docs and update card preview
mikhailChelbaev Dec 23, 2024
93c416c
update card preview
mikhailChelbaev Dec 23, 2024
a185afb
update docs
mikhailChelbaev Dec 23, 2024
ba0c31e
implement SUCard
mikhailChelbaev Dec 23, 2024
da0074e
add docs for sucard
mikhailChelbaev Dec 23, 2024
4566f9a
fix docs
mikhailChelbaev Dec 23, 2024
1d811cd
reorganize helpers folder
mikhailChelbaev Dec 23, 2024
8b6414d
move modal to components
mikhailChelbaev Dec 23, 2024
16501c8
add AlertVM, AlertButtonVM, UKAlertController and AlertPreview
mikhailChelbaev Dec 24, 2024
dd759f3
change alert's title and subtitle to optional
mikhailChelbaev Dec 24, 2024
53499c0
fix alert's button layout calculations
mikhailChelbaev Dec 24, 2024
ac0a22e
add more properties to alert's preview
mikhailChelbaev Dec 24, 2024
2ca849d
refactor alert controller
mikhailChelbaev Dec 25, 2024
41839c9
add docs for ukalert
mikhailChelbaev Dec 25, 2024
dacbe5c
display OK action if no actions are added to the alert
mikhailChelbaev Dec 25, 2024
da17537
improve the way of adding primary and secondary buttons in UKAlert
mikhailChelbaev Dec 25, 2024
8556749
update docs
mikhailChelbaev Dec 25, 2024
05e7eed
update docs
mikhailChelbaev Dec 25, 2024
9715b1d
add `suAlert` modifier
mikhailChelbaev Dec 25, 2024
f9f144a
add alert buttons and a helper to calculate orientation for these but…
mikhailChelbaev Dec 26, 2024
08aba80
set alert buttons spacing
mikhailChelbaev Dec 26, 2024
4cc78f1
fix bug when the width of the modal could be greater than `maxWidth` …
mikhailChelbaev Dec 26, 2024
c0af4e7
run swiftlint
mikhailChelbaev Dec 26, 2024
471148d
Merge branch 'sualert' into fix/ukmodal
mikhailChelbaev Dec 26, 2024
63a84a8
changed default border width values in the config
mikhailChelbaev Dec 26, 2024
a0861dd
added border width param to modals and alert
mikhailChelbaev Dec 26, 2024
2bcae21
added border width param to card
mikhailChelbaev Dec 26, 2024
28ffd6b
remove demos
mikhailChelbaev Dec 26, 2024
7ac0d10
change number of min and max rows in the `textInput` preview
mikhailChelbaev Dec 26, 2024
513175e
update border color in UKModalController when the interface style cha…
mikhailChelbaev Dec 27, 2024
6e674e4
fix typo in mark
mikhailChelbaev Dec 27, 2024
b170c61
Merge branch 'refactor/borders' into refactor/previews
mikhailChelbaev Dec 27, 2024
4bf94fd
replace a workaround with a working solution
mikhailChelbaev Dec 27, 2024
ba9a047
add method for blending colors
mikhailChelbaev Dec 27, 2024
fbcc971
remove second background in the modal and apply color blending instead
mikhailChelbaev Dec 27, 2024
461826f
remove second background from the card
mikhailChelbaev Dec 27, 2024
f70f1d6
update a method to calculate component's background color
mikhailChelbaev Dec 27, 2024
c4a619c
fix: change color for a transparent overlay style in `ModalOverlay`
mikhailChelbaev Dec 27, 2024
bafbdb2
disable large_tuple swiftlint rule
mikhailChelbaev Dec 27, 2024
94e2c52
add `shadow` helper method for `UIKit`
mikhailChelbaev Dec 27, 2024
a708a5c
merge with ukcard
mikhailChelbaev Dec 27, 2024
b87030e
Merge pull request #40 from componentskit/ukcard
mikhailChelbaev Dec 27, 2024
ae2457a
Merge pull request #41 from componentskit/sucard
mikhailChelbaev Dec 27, 2024
36cd493
Merge pull request #42 from componentskit/refactor/helpers
mikhailChelbaev Dec 27, 2024
f7b2047
Merge pull request #44 from componentskit/ukalert
mikhailChelbaev Dec 30, 2024
823a8fa
Merge pull request #45 from componentskit/sualert
mikhailChelbaev Dec 30, 2024
4fc24cf
Merge pull request #46 from componentskit/fix/ukmodal
mikhailChelbaev Dec 30, 2024
0ffc587
Merge pull request #47 from componentskit/refactor/borders
mikhailChelbaev Dec 30, 2024
6ae288c
Merge pull request #48 from componentskit/refactor/previews
mikhailChelbaev Jan 1, 2025
44350ca
Merge pull request #49 from componentskit/refactor/blend-colors
mikhailChelbaev Jan 1, 2025
cb4a6fb
adapt ukmodal position when a keyboard appears / disappears
mikhailChelbaev Jan 2, 2025
41b7721
change sumodal content alignment
mikhailChelbaev Jan 2, 2025
0f7fd23
Merge pull request #51 from componentskit/fix/modal-keyboard-interaction
mikhailChelbaev Jan 2, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .github/workflows/swiftlint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: SwiftLint

on:
pull_request:
paths:
- '.github/workflows/swiftlint.yml'
- '.swiftlint.yml'
- '**/*.swift'

jobs:
SwiftLint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Run SwiftLint
uses: norio-nomura/[email protected]
with:
args: --strict
3 changes: 1 addition & 2 deletions .swiftlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ only_rules:
- is_disjoint

# Tuples shouldn’t have too many members. Create a custom type instead
- large_tuple
# - large_tuple

# Prefer using .last(where:) over .filter { }.last in collections
- last_where
Expand Down Expand Up @@ -409,7 +409,6 @@ function_body_length:

included:
- Sources
- Examples

excluded:
- .swiftpm
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,246 @@
import ComponentsKit
import SwiftUI
import UIKit

struct ModalPreviewHelpers {
// MARK: - Enums

enum ContentBody {
case shortText
case longText
}
enum ContentFooter {
case button
case buttonAndCheckbox
}

// MARK: - Preview Sections

struct ContentSection<VM: ModalVM>: View {
@Binding var model: VM
@Binding var hasHeader: Bool
@Binding var contentBody: ContentBody
@Binding var contentFooter: ContentFooter?

var body: some View {
Section("Content") {
Picker("Header", selection: self.$hasHeader) {
Text("Text").tag(true)
Text("None").tag(false)
}
Picker("Body", selection: self.$contentBody) {
Text("Short Text").tag(ContentBody.shortText)
Text("Long Text").tag(ContentBody.longText)
}
Picker("Footer", selection: .init(
get: {
return self.contentFooter
},
set: { newValue in
if newValue == nil {
self.model.closesOnOverlayTap = true
}
self.contentFooter = newValue
}
)) {
Text("Button").tag(ContentFooter.button)
Text("Button and Checkbox").tag(ContentFooter.buttonAndCheckbox)
Text("None").tag(Optional<ContentFooter>.none)
}
}
}
}

struct PropertiesSection<VM: ModalVM, Pickers: View>: View {
@Binding var model: VM
@Binding var footer: ContentFooter?
@ViewBuilder var additionalPickers: () -> Pickers

var body: some View {
Section("Properties") {
Picker("Background Color", selection: self.$model.backgroundColor) {
Text("Default").tag(Optional<UniversalColor>.none)
Text("Accent Background").tag(ComponentColor.accent.background)
Text("Success Background").tag(ComponentColor.success.background)
Text("Warning Background").tag(ComponentColor.warning.background)
Text("Danger Background").tag(ComponentColor.danger.background)
}
BorderWidthPicker(selection: self.$model.borderWidth)
Toggle("Closes On Overlay Tap", isOn: self.$model.closesOnOverlayTap)
.disabled(self.footer == nil)
Picker("Outer Paddings", selection: self.$model.outerPaddings) {
Text("12px").tag(Paddings(padding: 12))
Text("16px").tag(Paddings(padding: 16))
Text("20px").tag(Paddings(padding: 20))
}
Picker("Content Spacing", selection: self.$model.contentSpacing) {
Text("8px").tag(CGFloat(8))
Text("12px").tag(CGFloat(12))
Text("16px").tag(CGFloat(16))
}
Picker("Content Paddings", selection: self.$model.contentPaddings) {
Text("12px").tag(Paddings(padding: 12))
Text("16px").tag(Paddings(padding: 16))
Text("20px").tag(Paddings(padding: 20))
}
ContainerRadiusPicker(selection: self.$model.cornerRadius) {
Text("Custom 30px").tag(ContainerRadius.custom(30))
}
OverlayStylePicker(selection: self.$model.overlayStyle)
Picker("Size", selection: self.$model.size) {
Text("Small").tag(ModalSize.small)
Text("Medium").tag(ModalSize.medium)
Text("Large").tag(ModalSize.large)
Text("Full").tag(ModalSize.full)
}
TransitionPicker(selection: self.$model.transition)
self.additionalPickers()
}
}
}

// MARK: - Shared UI

private static let headerTitle = "Header"
private static let headerFont: UniversalFont = .system(size: 20, weight: .bold)

private static let bodyShortText = "Lorem ipsum dolor sit amet, consectetur adipiscing elit."
private static let bodyLongText = """
Lorem ipsum odor amet, consectetuer adipiscing elit. Vitae vehicula pellentesque lectus orci fames. Cras suscipit dui tortor penatibus turpis ultrices. Laoreet montes adipiscing ante dapibus facilisis. Lorem per fames nec duis quis eleifend imperdiet. Tincidunt id interdum adipiscing eros dis quis platea varius. Potenti eleifend eu molestie laoreet varius sapien. Adipiscing nascetur platea penatibus curabitur tempus nibh laoreet porttitor. Augue et curabitur cras sed semper inceptos nunc montes mollis.

Lectus arcu pellentesque inceptos tempor fringilla nascetur. Erat curae convallis integer mi, quis facilisi tortor. Phasellus aliquam molestie vehicula odio in dis maximus diam elit. Rutrum gravida amet euismod feugiat fusce. Est egestas velit vulputate senectus sociosqu fringilla eget nibh. Nam pellentesque aenean mi platea tincidunt quam sem purus. Himenaeos suspendisse nec sapien habitasse ultricies maecenas libero odio. Rutrum senectus maximus ultrices, ad nam ultricies placerat.

Enim habitant laoreet inceptos scelerisque senectus, tellus molestie ut. Eros risus nibh morbi eu aenean. Velit ligula magnis aliquet at luctus. Dapibus vestibulum consectetur euismod vitae per ultrices litora quis. Aptent eleifend dapibus urna lacinia felis nisl. Sit amet fusce nullam feugiat posuere. Urna amet curae velit fermentum interdum vestibulum penatibus. Penatibus vivamus sem ultricies pellentesque congue id mattis diam. Aliquam efficitur mi gravida sollicitudin; amet imperdiet. Rutrum mollis risus justo tortor in duis cursus.
"""
private static let bodyFont: UniversalFont = .system(size: 18, weight: .regular)

private static let footerButtonVM = ButtonVM {
$0.title = "Close"
$0.isFullWidth = true
$0.color = .primary
}
private static let footerCheckboxVM = CheckboxVM {
$0.title = "Agree and continue"
}

// MARK: - UIKit

static func ukHeader(hasHeader: Bool) -> UKModalController.Content? {
guard hasHeader else {
return nil
}

return { _ in
let title = UILabel()
title.text = self.headerTitle
title.font = self.headerFont.uiFont
return title
}
}

static func ukBody(body: ContentBody) -> UKModalController.Content {
return { _ in
let subtitle = UILabel()
switch body {
case .shortText:
subtitle.text = self.bodyShortText
case .longText:
subtitle.text = self.bodyLongText
}
subtitle.numberOfLines = 0
subtitle.font = self.bodyFont.uiFont
return subtitle
}
}

static func ukFooter(footer: ContentFooter?) -> UKModalController.Content? {
return footer.map { footer in
return { dismiss in
let stackView = UIStackView()
stackView.axis = .vertical
stackView.spacing = 16

let button = UKButton(
model: self.footerButtonVM,
action: { dismiss(true) }
)
stackView.addArrangedSubview(button)

switch footer {
case .button:
button.model.isEnabled = true
case .buttonAndCheckbox:
button.model.isEnabled = false
let checkbox = UKCheckbox(
initialValue: false,
model: self.footerCheckboxVM,
onValueChange: { isSelected in
button.model.isEnabled = isSelected
}
)
stackView.insertArrangedSubview(checkbox, at: 0)
}

return stackView
}
}
}

// MARK: - SwiftUI

static func suHeader(hasHeader: Bool) -> some View {
Group {
if hasHeader {
HStack {
Text(self.headerTitle)
.font(self.headerFont.font)
Spacer()
}
} else {
EmptyView()
}
}
}

static func suBody(body: ContentBody) -> some View {
Group {
switch body {
case .shortText:
Text(self.bodyShortText)
case .longText:
Text(self.bodyLongText)
}
}
.font(self.bodyFont.font)
.multilineTextAlignment(.leading)
}

static func suFooter(
isPresented: Binding<Bool>,
isCheckboxSelected: Binding<Bool>,
footer: ContentFooter?
) -> some View {
Group {
switch footer {
case .none:
EmptyView()
case .button:
SUButton(model: self.footerButtonVM) {
isPresented.wrappedValue = false
}
case .buttonAndCheckbox:
VStack(alignment: .leading, spacing: 16) {
SUCheckbox(
isSelected: isCheckboxSelected,
model: self.footerCheckboxVM
)
SUButton(model: self.footerButtonVM.updating {
$0.isEnabled = isCheckboxSelected.wrappedValue
}) {
isPresented.wrappedValue = false
}
}
}
}
}
}
Loading
Loading