Skip to content

Commit

Permalink
fix(Button): change colors for disabled style (#310)
Browse files Browse the repository at this point in the history
  • Loading branch information
jaranaz committed Oct 13, 2023
1 parent 26a73b3 commit fb108a1
Show file tree
Hide file tree
Showing 17 changed files with 26 additions and 13 deletions.
39 changes: 26 additions & 13 deletions Sources/MisticaSwiftUI/Components/Button/MisticaButtonStyle.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,20 @@ public struct MisticaButtonStyle: ButtonStyle {

// MARK: Styles

private var _opacity = 0.5
private var _opacityWithBackground = 0.1

public extension ButtonStyle where Self == MisticaButtonStyle {
static var opacity: CGFloat {
get { _opacity }
set { _opacity = newValue }
}

static var opacityWithBackground: CGFloat {
get { _opacityWithBackground }
set { _opacityWithBackground = newValue }
}

static func misticaPrimary(
small: Bool = false,
bleedingAlignment: ButtonBleedingAlignment = .none
Expand All @@ -43,8 +56,8 @@ public extension ButtonStyle where Self == MisticaButtonStyle {
),
.disabled: MisticaButton.StateStyle(
textColor: .textButtonPrimary,
backgroundColor: .buttonPrimaryBackground.opacity(0.5),
borderColor: .buttonPrimaryBackground.opacity(0.1)
backgroundColor: .buttonPrimaryBackground.opacity(opacity),
borderColor: .buttonPrimaryBackground.opacity(opacityWithBackground)
),
.loading: MisticaButton.StateStyle(
textColor: .textButtonPrimary,
Expand Down Expand Up @@ -78,8 +91,8 @@ public extension ButtonStyle where Self == MisticaButtonStyle {
),
.disabled: MisticaButton.StateStyle(
textColor: .textButtonPrimaryInverse,
backgroundColor: .buttonPrimaryBackgroundInverse,
borderColor: .buttonPrimaryBackgroundInverse
backgroundColor: .buttonPrimaryBackgroundInverse.opacity(opacity),
borderColor: .buttonPrimaryBackgroundInverse.opacity(opacityWithBackground)
),
.loading: MisticaButton.StateStyle(
textColor: .textButtonPrimaryInverse,
Expand Down Expand Up @@ -112,9 +125,9 @@ public extension ButtonStyle where Self == MisticaButtonStyle {
borderColor: .buttonSecondaryBackgroundSelected
),
.disabled: MisticaButton.StateStyle(
textColor: .textButtonSecondary,
textColor: .textButtonSecondary.opacity(opacity),
backgroundColor: .clear,
borderColor: .buttonSecondaryBorder
borderColor: .buttonSecondaryBorder.opacity(opacity)
),
.loading: MisticaButton.StateStyle(
textColor: .textButtonSecondary,
Expand Down Expand Up @@ -147,9 +160,9 @@ public extension ButtonStyle where Self == MisticaButtonStyle {
borderColor: .buttonSecondaryBorderInverseSelected
),
.disabled: MisticaButton.StateStyle(
textColor: .textButtonSecondaryInverse,
textColor: .textButtonSecondaryInverse.opacity(opacity),
backgroundColor: .clear,
borderColor: .buttonSecondaryBorderInverse
borderColor: .buttonSecondaryBorderInverse.opacity(opacity)
),
.loading: MisticaButton.StateStyle(
textColor: .textButtonSecondaryInverse,
Expand Down Expand Up @@ -183,8 +196,8 @@ public extension ButtonStyle where Self == MisticaButtonStyle {
),
.disabled: MisticaButton.StateStyle(
textColor: .textButtonPrimary,
backgroundColor: .buttonDangerBackground,
borderColor: .buttonDangerBackground
backgroundColor: .buttonDangerBackground.opacity(opacity),
borderColor: .buttonDangerBackground.opacity(opacityWithBackground)
),
.loading: MisticaButton.StateStyle(
textColor: .textButtonPrimary,
Expand Down Expand Up @@ -219,7 +232,7 @@ public extension ButtonStyle where Self == MisticaButtonStyle {
borderColor: .clear
),
.disabled: MisticaButton.StateStyle(
textColor: .textLink,
textColor: .textLink.opacity(opacity),
backgroundColor: .clear,
borderColor: .clear
),
Expand Down Expand Up @@ -256,7 +269,7 @@ public extension ButtonStyle where Self == MisticaButtonStyle {
borderColor: .clear
),
.disabled: MisticaButton.StateStyle(
textColor: .textButtonSecondaryInverse,
textColor: .textButtonSecondaryInverse.opacity(opacity),
backgroundColor: .clear,
borderColor: .clear
),
Expand Down Expand Up @@ -292,7 +305,7 @@ public extension ButtonStyle where Self == MisticaButtonStyle {
borderColor: .clear
),
.disabled: MisticaButton.StateStyle(
textColor: .textLinkSnackbar,
textColor: .textLinkSnackbar.opacity(opacity),
backgroundColor: .clear,
borderColor: .clear
),
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.

0 comments on commit fb108a1

Please sign in to comment.