Skip to content

Commit 1929022

Browse files
committed
Правки в иконках
- Задал фиксированный размер иконкам в ячейках SportsGroundRowView и EventRowView - Обновил иконку `noConnection` - Рефактор
1 parent c03294a commit 1929022

File tree

4 files changed

+37
-12
lines changed

4 files changed

+37
-12
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import SwiftUI
2+
3+
/// Вьюшка для системной иконки с настройкой фрейма
4+
///
5+
/// - По умолчанию имеет `.symbolVariant(.circle)` и размер `15 * 15`
6+
/// - Цвет - `Color.swAccent`
7+
struct SystemImageWithFrame: View {
8+
private let systemName: String
9+
private let size: CGSize
10+
private let isCircle: Bool
11+
12+
init(
13+
_ systemName: String,
14+
size: CGSize = .init(width: 15, height: 15),
15+
isCircle: Bool = true
16+
) {
17+
self.systemName = systemName
18+
self.size = size
19+
self.isCircle = isCircle
20+
}
21+
22+
var body: some View {
23+
Image(systemName: systemName)
24+
.resizable()
25+
.scaledToFit()
26+
.frame(width: size.width, height: size.height)
27+
.symbolVariant(isCircle ? .circle : .none)
28+
.foregroundStyle(Color.swAccent)
29+
}
30+
}

Sources/SWDesignSystem/Public/Icons.swift

+3-1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ public enum Icons {
1616
case settings = "gearshape"
1717

1818
public var view: some View { Image(systemName: rawValue) }
19+
public var imageView: Image { Image(systemName: rawValue) }
1920
}
2021

2122
/// Названия остальных иконок
@@ -25,7 +26,7 @@ public enum Icons {
2526
case eye
2627
case checkmark
2728
case share = "square.and.arrow.up"
28-
case noSignal = "wifi.exclamationmark"
29+
case noSignal = "wifi.slash"
2930
case gearshape
3031
case refresh = "arrow.triangle.2.circlepath"
3132
case exclamation = "exclamationmark.triangle"
@@ -50,6 +51,7 @@ public enum Icons {
5051
case chevron = "chevron.forward"
5152

5253
public var view: some View { Image(systemName: rawValue) }
54+
public var imageView: Image { Image(systemName: rawValue) }
5355
}
5456
}
5557

Sources/SWDesignSystem/Public/Rows/EventRowView.swift

+2-5
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,7 @@ private extension EventRowView {
4949

5050
var eventDateTimeInfo: some View {
5151
HStack(spacing: 6) {
52-
Icons.Regular.clock.view
53-
.foregroundStyle(Color.swAccent)
52+
SystemImageWithFrame(Icons.Regular.clock.rawValue, isCircle: false)
5453
Text(dateTimeText)
5554
.foregroundStyle(Color.swSmallElements)
5655
.font(.subheadline)
@@ -63,9 +62,7 @@ private extension EventRowView {
6362
var locationInfoIfNeeded: some View {
6463
if let locationText {
6564
HStack(spacing: 6) {
66-
Icons.Regular.location.view
67-
.symbolVariant(.circle)
68-
.foregroundStyle(Color.swAccent)
65+
SystemImageWithFrame(Icons.Regular.location.rawValue)
6966
Text(locationText)
7067
.foregroundColor(.swSmallElements)
7168
.font(.subheadline)

Sources/SWDesignSystem/Public/Rows/SportsGroundRowView.swift

+2-6
Original file line numberDiff line numberDiff line change
@@ -52,19 +52,15 @@ private extension SportsGroundRowView {
5252
var addressIfNeeded: some View {
5353
if let address {
5454
HStack(spacing: 6) {
55-
Icons.Regular.location.view
56-
.symbolVariant(.circle)
57-
.foregroundStyle(Color.swAccent)
55+
SystemImageWithFrame(Icons.Regular.location.rawValue)
5856
makeSubtitleView(with: address)
5957
}
6058
}
6159
}
6260

6361
var participantsInfo: some View {
6462
HStack(spacing: 6) {
65-
Icons.Regular.person.view
66-
.symbolVariant(.circle)
67-
.foregroundStyle(Color.swAccent)
63+
SystemImageWithFrame(Icons.Regular.person.rawValue)
6864
makeSubtitleView(with: usersTrainHereText)
6965
}
7066
}

0 commit comments

Comments
 (0)