-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Sequence Units level to Course home view as nested list (#192)
* feat: add expand section in detail course * refactor: add click animation and gray arrow * refactor: add new paddings * fix: new ids for expand sections * chore: add counter and remove banner * fix: top offset * chore: add course expandable sections enabled and course banner enabled * fix: tests * chore: move flags * chore: add new flag course nested list * fix: animation * chore: remove extra code * chore: change key name and merge with develop * chore: add arrow to header section * chore: add flags
- Loading branch information
1 parent
a7eb8e1
commit 7647134
Showing
18 changed files
with
510 additions
and
143 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
// | ||
// CustomDisclosureGroup.swift | ||
// Core | ||
// | ||
// Created by Eugene Yatsenko on 09.11.2023. | ||
// | ||
|
||
import SwiftUI | ||
|
||
public struct CustomDisclosureGroup<Header: View, Content: View>: View { | ||
|
||
@Binding var isExpanded: Bool | ||
|
||
private var onClick: () -> Void | ||
private var animation: Animation? | ||
private let header: Header | ||
private let content: Content | ||
|
||
public init( | ||
animation: Animation?, | ||
isExpanded: Binding<Bool>, | ||
onClick: @escaping () -> Void, | ||
header: (_ isExpanded: Bool) -> Header, | ||
content: () -> Content | ||
) { | ||
self.onClick = onClick | ||
self._isExpanded = isExpanded | ||
self.animation = animation | ||
self.header = header(isExpanded.wrappedValue) | ||
self.content = content() | ||
} | ||
|
||
public var body: some View { | ||
VStack(spacing: 0) { | ||
Button { | ||
withAnimation(animation) { | ||
onClick() | ||
} | ||
} label: { | ||
header | ||
.contentShape(Rectangle()) | ||
} | ||
if isExpanded { | ||
content | ||
} | ||
} | ||
.clipped() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.