Skip to content

Commit

Permalink
fix(Popover): Popover improvements (align with figma specs) (#291) re…
Browse files Browse the repository at this point in the history
…fs SMARTWIFI-7203

* EDIT - Make components public

* ADD - Pinned horizontally method to containerView

* EDIT - Delete horizontallyPinned method and make horizontally pinning default behavior

* EDIT - Record snapshots with new behavior

* EDIT - Make subtitle public too

* Run swiftformat

* EDIT - Move access control to computer variable (Alex Megias feedback)

* ADD - Test (Alex Feedback)

* EDIT - Make intrinsicHeightLabel internal again

* Run swiftformat

---------

Co-authored-by: crisrojas <crisrojas@users.noreply.github.com>
  • Loading branch information
crisrojas and crisrojas authored Jul 19, 2023
1 parent 36351f4 commit db1dfb0
Show file tree
Hide file tree
Showing 22 changed files with 13 additions and 8 deletions.
8 changes: 8 additions & 0 deletions Sources/Mistica/Components/Lists/ListCellContentView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,14 @@ open class ListCellContentView: UIView {

// MARK: Public

public var titleLabel: UILabel {
centerSection.titleLabel
}

public var subtitleLabel: UILabel {
centerSection.subtitleLabel
}

public var title: String? {
get {
centerSection.titleLabel.text
Expand Down
11 changes: 4 additions & 7 deletions Sources/Mistica/Components/Popover/PopoverView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -246,14 +246,11 @@ private extension PopoverView {
centerX.isActive = true

NSLayoutConstraint.activate([
// Maximum width is container width minus the margin
widthAnchor.constraint(lessThanOrEqualTo: containerView.widthAnchor, constant: -(ViewStyles.leadingMarginToContainerView + ViewStyles.trailingMarginToContainerView)),
heightAnchor.constraint(equalTo: contentView.heightAnchor, constant: ViewStyles.tipSize.height),
// Width is 100% minus 32pt (16pt horizontal padding)
leadingAnchor.constraint(equalTo: containerView.leadingAnchor, constant: ViewStyles.leadingMarginToContainerView),
trailingAnchor.constraint(equalTo: containerView.trailingAnchor, constant: -ViewStyles.trailingMarginToContainerView),
contentView.widthAnchor.constraint(equalTo: widthAnchor),

// Keep the popover respecting the margin with containerView
leadingAnchor.constraint(greaterThanOrEqualTo: containerView.leadingAnchor, constant: ViewStyles.leadingMarginToContainerView),
trailingAnchor.constraint(lessThanOrEqualTo: containerView.trailingAnchor, constant: -ViewStyles.trailingMarginToContainerView)
heightAnchor.constraint(equalTo: contentView.heightAnchor, constant: ViewStyles.tipSize.height)
])

switch tipDirection {
Expand Down
2 changes: 1 addition & 1 deletion Tests/MisticaTests/UI/PopoverViewTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ final class PopoverViewTests: XCTestCase {

assertSnapshot(
matching: popover,
as: .image(size: .init(width: 200, height: 100))
as: .image(size: .init(width: 500, height: 100))
)
}

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit db1dfb0

Please sign in to comment.