-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Remove protocol into internal struct - Rename ForX parameters into UseCases - Rename IntentColor to Intent
- Loading branch information
Showing
54 changed files
with
639 additions
and
491 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
25 changes: 25 additions & 0 deletions
25
core/Sources/Components/Button/Properties/Internal/Border/ButtonBorder+ExtensionTests.swift
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,25 @@ | ||
// | ||
// ButtonBorder.swift | ||
// SparkCore | ||
// | ||
// Created by robin.lemaire on 23/06/2023. | ||
// Copyright © 2023 Adevinta. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
@testable import SparkCore | ||
|
||
extension ButtonBorder { | ||
|
||
// MARK: - Properties | ||
|
||
static func mocked( | ||
width: CGFloat = 2, | ||
radius: CGFloat = 8 | ||
) -> Self { | ||
return .init( | ||
width: width, | ||
radius: radius | ||
) | ||
} | ||
} |
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
28 changes: 0 additions & 28 deletions
28
core/Sources/Components/Button/Properties/Internal/ButtonColors.swift
This file was deleted.
Oops, something went wrong.
27 changes: 0 additions & 27 deletions
27
core/Sources/Components/Button/Properties/Internal/ButtonContent.swift
This file was deleted.
Oops, something went wrong.
24 changes: 0 additions & 24 deletions
24
core/Sources/Components/Button/Properties/Internal/ButtonCurrentColors.swift
This file was deleted.
Oops, something went wrong.
30 changes: 30 additions & 0 deletions
30
core/Sources/Components/Button/Properties/Internal/Colors/ButtonColors+ExtensionTests.swift
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,30 @@ | ||
// | ||
// ButtonColors.swift | ||
// Spark | ||
// | ||
// Created by janniklas.freundt.ext on 02.05.23. | ||
// Copyright © 2023 Adevinta. All rights reserved. | ||
// | ||
|
||
@testable import SparkCore | ||
|
||
extension ButtonColors { | ||
|
||
// MARK: - Properties | ||
|
||
static func mocked( | ||
foregroundColor: any ColorToken = ColorTokenGeneratedMock.random(), | ||
backgroundColor: any ColorToken = ColorTokenGeneratedMock.random(), | ||
pressedBackgroundColor: any ColorToken = ColorTokenGeneratedMock.random(), | ||
borderColor: any ColorToken = ColorTokenGeneratedMock.random(), | ||
pressedBorderColor: any ColorToken = ColorTokenGeneratedMock.random() | ||
) -> Self { | ||
return .init( | ||
foregroundColor: foregroundColor, | ||
backgroundColor: backgroundColor, | ||
pressedBackgroundColor: pressedBackgroundColor, | ||
borderColor: borderColor, | ||
pressedBorderColor: pressedBorderColor | ||
) | ||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
core/Sources/Components/Button/Properties/Internal/Colors/ButtonColors.swift
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,36 @@ | ||
// | ||
// ButtonColors.swift | ||
// Spark | ||
// | ||
// Created by janniklas.freundt.ext on 02.05.23. | ||
// Copyright © 2023 Adevinta. All rights reserved. | ||
// | ||
|
||
/// All Button Colors from a theme, variant and intents | ||
struct ButtonColors { | ||
|
||
// MARK: - Properties | ||
|
||
let foregroundColor: any ColorToken | ||
let backgroundColor: any ColorToken | ||
let pressedBackgroundColor: any ColorToken | ||
let borderColor: any ColorToken | ||
let pressedBorderColor: any ColorToken | ||
} | ||
|
||
// MARK: Hashable & Equatable | ||
|
||
extension ButtonColors: Hashable, Equatable { | ||
|
||
func hash(into hasher: inout Hasher) { | ||
hasher.combine(self.foregroundColor) | ||
hasher.combine(self.backgroundColor) | ||
hasher.combine(self.pressedBackgroundColor) | ||
hasher.combine(self.borderColor) | ||
hasher.combine(self.pressedBorderColor) | ||
} | ||
|
||
static func == (lhs: ButtonColors, rhs: ButtonColors) -> Bool { | ||
return lhs.hashValue == rhs.hashValue | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
.../Sources/Components/Button/Properties/Internal/Content/ButtonContent+ExtensionTests.swift
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,28 @@ | ||
// | ||
// ButtonContent.swift | ||
// SparkCore | ||
// | ||
// Created by robin.lemaire on 27/06/2023. | ||
// Copyright © 2023 Adevinta. All rights reserved. | ||
// | ||
|
||
@testable import SparkCore | ||
|
||
extension ButtonContent { | ||
|
||
// MARK: - Properties | ||
|
||
static func mocked( | ||
shouldShowIconImage: Bool = true , | ||
isIconImageOnRight: Bool = false, | ||
iconImage: ImageEither? = .left(IconographyTests.shared.arrow), | ||
shouldShowText: Bool = true | ||
) -> Self { | ||
return .init( | ||
shouldShowIconImage: shouldShowIconImage, | ||
isIconImageOnRight: isIconImageOnRight, | ||
iconImage: iconImage, | ||
shouldShowText: shouldShowText | ||
) | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
core/Sources/Components/Button/Properties/Internal/Content/ButtonContent.swift
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,18 @@ | ||
// | ||
// ButtonContent.swift | ||
// SparkCore | ||
// | ||
// Created by robin.lemaire on 27/06/2023. | ||
// Copyright © 2023 Adevinta. All rights reserved. | ||
// | ||
|
||
struct ButtonContent: Equatable { | ||
|
||
// MARK: - Properties | ||
|
||
let shouldShowIconImage: Bool | ||
let isIconImageOnRight: Bool | ||
let iconImage: ImageEither? | ||
|
||
let shouldShowText: Bool | ||
} |
26 changes: 26 additions & 0 deletions
26
...ponents/Button/Properties/Internal/CurrentColors/ButtonCurrentColors+ExtensionTests.swift
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,26 @@ | ||
// | ||
// ButtonCurrentColors.swift | ||
// SparkCore | ||
// | ||
// Created by robin.lemaire on 27/06/2023. | ||
// Copyright © 2023 Adevinta. All rights reserved. | ||
// | ||
|
||
@testable import SparkCore | ||
|
||
extension ButtonCurrentColors { | ||
|
||
// MARK: - Properties | ||
|
||
static func mocked( | ||
foregroundColor: any ColorToken = ColorTokenGeneratedMock.random(), | ||
backgroundColor: any ColorToken = ColorTokenGeneratedMock.random(), | ||
borderColor: any ColorToken = ColorTokenGeneratedMock.random() | ||
) -> Self { | ||
return .init( | ||
foregroundColor: foregroundColor, | ||
backgroundColor: backgroundColor, | ||
borderColor: borderColor | ||
) | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
core/Sources/Components/Button/Properties/Internal/CurrentColors/ButtonCurrentColors.swift
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,33 @@ | ||
// | ||
// ButtonCurrentColors.swift | ||
// SparkCore | ||
// | ||
// Created by robin.lemaire on 27/06/2023. | ||
// Copyright © 2023 Adevinta. All rights reserved. | ||
// | ||
|
||
/// Current Button Colors properties from a button colors and state | ||
struct ButtonCurrentColors { | ||
|
||
// MARK: - Properties | ||
|
||
let foregroundColor: any ColorToken | ||
let backgroundColor: any ColorToken | ||
let borderColor: any ColorToken | ||
} | ||
|
||
// MARK: Hashable & Equatable | ||
|
||
extension ButtonCurrentColors: Hashable, Equatable { | ||
|
||
func hash(into hasher: inout Hasher) { | ||
hasher.combine(self.foregroundColor) | ||
hasher.combine(self.backgroundColor) | ||
hasher.combine(self.borderColor) | ||
} | ||
|
||
static func == (lhs: ButtonCurrentColors, rhs: ButtonCurrentColors) -> Bool { | ||
return lhs.hashValue == rhs.hashValue | ||
} | ||
} | ||
|
25 changes: 25 additions & 0 deletions
25
core/Sources/Components/Button/Properties/Internal/Sizes/ButtonSizes+ExtensionTests.swift
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,25 @@ | ||
// | ||
// ButtonSizes.swift | ||
// SparkCore | ||
// | ||
// Created by robin.lemaire on 30/06/2023. | ||
// Copyright © 2023 Adevinta. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
@testable import SparkCore | ||
|
||
extension ButtonSizes { | ||
|
||
// MARK: - Properties | ||
|
||
static func mocked( | ||
height: CGFloat = 30, | ||
iconSize: CGFloat = 20 | ||
) -> Self { | ||
return .init( | ||
height: height, | ||
iconSize: iconSize | ||
) | ||
} | ||
} |
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
27 changes: 27 additions & 0 deletions
27
...ources/Components/Button/Properties/Internal/Spacings/ButtonSpacings+ExtensionTests.swift
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,27 @@ | ||
// | ||
// ButtonSpacings.swift | ||
// SparkCore | ||
// | ||
// Created by robin.lemaire on 23/06/2023. | ||
// Copyright © 2023 Adevinta. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
@testable import SparkCore | ||
|
||
extension ButtonSpacings { | ||
|
||
// MARK: - Properties | ||
|
||
static func mocked( | ||
verticalSpacing: CGFloat = 10, | ||
horizontalSpacing: CGFloat = 11, | ||
horizontalPadding: CGFloat = 12 | ||
) -> Self { | ||
return .init( | ||
verticalSpacing: verticalSpacing, | ||
horizontalSpacing: horizontalSpacing, | ||
horizontalPadding: horizontalPadding | ||
) | ||
} | ||
} |
Oops, something went wrong.