Skip to content

Commit

Permalink
sanitization. Addressed PR Comments
Browse files Browse the repository at this point in the history
  • Loading branch information
amoggo committed Sep 12, 2022
1 parent 9958ac4 commit 5d90ede
Showing 1 changed file with 9 additions and 14 deletions.
23 changes: 9 additions & 14 deletions macos/FluentUI/Button/Button.swift
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ open class Button: NSButton {

private static let borderWidth: CGFloat = 1

private var minButtonHeight: CGFloat?
private var minButtonHeight: CGFloat = ButtonSizeParameters.large.minButtonHeight

This comment has been minimized.

Copy link
@brentpe

brentpe Sep 12, 2022

Contributor

I guess we're just using the same pattern here as "cornerRadius" and defaulting to large initially?


private func setSizeParameters(forSize: ButtonSize) {
let parameters = ButtonSizeParameters.parameters(forSize: size)
Expand Down Expand Up @@ -374,13 +374,8 @@ open class Button: NSButton {

open override var intrinsicContentSize: CGSize {
let superSize = super.intrinsicContentSize
let height = { () -> CGFloat in
if let minButtonHeight = self.minButtonHeight {
return superSize.height <= minButtonHeight ? minButtonHeight : superSize.height
}
return superSize.height
}
return CGSize(width: superSize.width, height: height())
return CGSize(width: superSize.width,
height: superSize.height < minButtonHeight ? minButtonHeight : superSize.height)
}
}

Expand Down Expand Up @@ -537,14 +532,14 @@ class ButtonCell: NSButtonCell {
/// Indicates the size of the button
@objc(MSFButtonSize)
public enum ButtonSize: Int, CaseIterable {
/// Button Height - 28 pts

/// Minimum Button Height - 28 pts
case large
/// Button Height - 24 pts

/// Minimum Button Height - 24 pts
case medium
/// Button Height - 20 pts

/// Minimum Button Height - 20 pts
case small
}

Expand Down

0 comments on commit 5d90ede

Please sign in to comment.