Skip to content

Commit 2ae40fb

Browse files
add docs for modal vms
1 parent 18fa199 commit 2ae40fb

File tree

3 files changed

+75
-5
lines changed

3 files changed

+75
-5
lines changed

Sources/ComponentsKit/Modal/Models/BottomModalVM.swift

Lines changed: 34 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,57 @@ import Foundation
22

33
/// A model that defines the appearance properties for a bottom modal component.
44
public struct BottomModalVM: ModalVM {
5+
/// The background color of the modal's content area.
56
public var backgroundColor: UniversalColor = Palette.Base.secondaryBackground
67

8+
/// A Boolean value indicating whether the modal should close when tapping on the overlay.
9+
///
10+
/// Defaults to `true`.
711
public var closesOnOverlayTap: Bool = true
812

13+
/// The padding applied to the modal's content area.
14+
///
15+
/// Defaults to a padding value of `16` for all sides.
916
public var contentPaddings: Paddings = .init(padding: 16)
1017

18+
/// The spacing between header, body and footer.
1119
public var contentSpacing: CGFloat = 16
1220

21+
/// The corner radius of the modal.
22+
///
23+
/// Defaults to `.medium`.
1324
public var cornerRadius: ModalRadius = .medium
1425

26+
/// A Boolean value indicating whether the modal should hide when it is swiped down.
27+
///
28+
/// Defaults to `true`.
29+
public var hidesOnSwap: Bool = true
30+
31+
/// A Boolean value indicating whether the modal is draggable.
32+
///
33+
/// If `true`, the modal can be dragged vertically. Defaults to `true`.
34+
public var isDraggable: Bool = true
35+
36+
/// The style of the overlay displayed behind the modal.
37+
///
38+
/// Defaults to `.dimmed`.
1539
public var overlayStyle: ModalOverlayStyle = .dimmed
1640

41+
/// The padding applied outside the modal's content area, creating space between the modal and the screen edges.
42+
///
43+
/// Defaults to a padding value of `20` for all sides.
1744
public var outerPaddings: Paddings = .init(padding: 20)
1845

46+
/// The predefined maximum size of the modal.
47+
///
48+
/// Defaults to `.medium`.
1949
public var size: ModalSize = .medium
2050

51+
/// The transition duration of the modal's appearance and dismissal animations.
52+
///
53+
/// Defaults to `.fast`.
2154
public var transition: ModalTransition = .fast
2255

23-
public var isDraggable: Bool = true
24-
public var hidesOnSwap: Bool = true
25-
26-
/// Initializes a new instance of `ModalVM` with default values.
56+
/// Initializes a new instance of `BottomModalVM` with default values.
2757
public init() {}
2858
}

Sources/ComponentsKit/Modal/Models/CenterModalVM.swift

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,47 @@ import Foundation
22

33
/// A model that defines the appearance properties for a center modal component.
44
public struct CenterModalVM: ModalVM {
5+
/// The background color of the modal's content area.
56
public var backgroundColor: UniversalColor = Palette.Base.secondaryBackground
67

8+
/// A Boolean value indicating whether the modal should close when tapping on the overlay.
9+
///
10+
/// Defaults to `true`.
711
public var closesOnOverlayTap: Bool = true
812

13+
/// The padding applied to the modal's content area.
14+
///
15+
/// Defaults to a padding value of `16` for all sides.
916
public var contentPaddings: Paddings = .init(padding: 16)
1017

18+
/// The spacing between header, body and footer.
1119
public var contentSpacing: CGFloat = 16
1220

21+
/// The corner radius of the modal.
22+
///
23+
/// Defaults to `.medium`.
1324
public var cornerRadius: ModalRadius = .medium
1425

26+
/// The style of the overlay displayed behind the modal.
27+
///
28+
/// Defaults to `.dimmed`.
1529
public var overlayStyle: ModalOverlayStyle = .dimmed
1630

31+
/// The padding applied outside the modal's content area, creating space between the modal and the screen edges.
32+
///
33+
/// Defaults to a padding value of `20` for all sides.
1734
public var outerPaddings: Paddings = .init(padding: 20)
1835

36+
/// The predefined maximum size of the modal.
37+
///
38+
/// Defaults to `.medium`.
1939
public var size: ModalSize = .medium
2040

41+
/// The transition duration of the modal's appearance and dismissal animations.
42+
///
43+
/// Defaults to `.fast`.
2144
public var transition: ModalTransition = .fast
2245

23-
/// Initializes a new instance of `ModalVM` with default values.
46+
/// Initializes a new instance of `BottomModalVM` with default values.
2447
public init() {}
2548
}

Sources/ComponentsKit/Modal/Models/ModalVM.swift

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,30 @@ import Foundation
22

33
/// A model that defines generic appearance properties that can be in any modal component.
44
public protocol ModalVM: ComponentVM {
5+
/// The background color of the modal's content area.
56
var backgroundColor: UniversalColor { get set }
7+
8+
/// A Boolean value indicating whether the modal should close when tapping on the overlay.
69
var closesOnOverlayTap: Bool { get set }
10+
11+
/// The padding applied to the modal's content area.
712
var contentPaddings: Paddings { get set }
13+
14+
/// The spacing between header, body and footer.
815
var contentSpacing: CGFloat { get set }
16+
17+
/// The corner radius of the modal.
918
var cornerRadius: ModalRadius { get set }
19+
20+
/// The style of the overlay displayed behind the modal.
1021
var overlayStyle: ModalOverlayStyle { get set }
22+
23+
/// The padding applied outside the modal's content area, creating space between the modal and the screen edges.
1124
var outerPaddings: Paddings { get set }
25+
26+
/// The predefined maximum size of the modal.
1227
var size: ModalSize { get set }
28+
29+
/// The transition duration of the modal's appearance and dismissal animations.
1330
var transition: ModalTransition { get set }
1431
}

0 commit comments

Comments
 (0)