-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨ (LekaApp): Add Caregiver Profile in sidebar
- Loading branch information
Showing
11 changed files
with
526 additions
and
69 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
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
71 changes: 71 additions & 0 deletions
71
...urces/_NEWCodeBase/Views/CaregiverSettingsView/CaregiverSettingsView+AccentColorRow.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,71 @@ | ||
// Leka - iOS Monorepo | ||
// Copyright APF France handicap | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
import DesignKit | ||
import LocalizationKit | ||
import SwiftUI | ||
|
||
// swiftlint:disable nesting | ||
|
||
// MARK: - CaregiverSettingsView.AccentColorRow | ||
|
||
extension CaregiverSettingsView { | ||
struct AccentColorRow: View { | ||
// MARK: Internal | ||
|
||
@Binding var caregiver: Caregiver | ||
|
||
var body: some View { | ||
HStack { | ||
Text(l10n.CaregiverSettingsView.AccentColorRow.title) | ||
|
||
Spacer() | ||
|
||
ForEach(self.colors, id: \.self) { color in | ||
ColorCircleView(color: color, isSelected: self.selectedColor == color) | ||
.onTapGesture { | ||
self.styleManager.accentColor = color | ||
self.caregiver.preferredAccentColor = color | ||
} | ||
} | ||
} | ||
} | ||
|
||
// MARK: Private | ||
|
||
// MARK: - ColorCircleView | ||
|
||
private struct ColorCircleView: View { | ||
let color: Color | ||
let isSelected: Bool | ||
|
||
var body: some View { | ||
VStack { | ||
Circle() | ||
.fill(self.color) | ||
.frame(width: 25) | ||
.overlay(Circle().fill(self.isSelected ? .white : .clear).frame(width: 8)) | ||
.overlay(Circle().stroke(.gray, lineWidth: 0.5)) | ||
} | ||
.animation(.easeIn, value: self.isSelected) | ||
} | ||
} | ||
|
||
@ObservedObject private var styleManager: StyleManager = .shared | ||
|
||
private let colors: [Color] = [DesignKitAsset.Colors.lekaDarkBlue.swiftUIColor, .blue, .purple, .red, .orange, .yellow, .green, .gray] | ||
|
||
private var selectedColor: Color { | ||
self.styleManager.accentColor ?? .clear | ||
} | ||
} | ||
} | ||
|
||
// swiftlint:enable nesting | ||
|
||
#Preview { | ||
Form { | ||
CaregiverSettingsView.AccentColorRow(caregiver: .constant(Caregiver())) | ||
} | ||
} |
43 changes: 43 additions & 0 deletions
43
...ources/_NEWCodeBase/Views/CaregiverSettingsView/CaregiverSettingsView+AppearanceRow.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,43 @@ | ||
// Leka - iOS Monorepo | ||
// Copyright APF France handicap | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
import DesignKit | ||
import LocalizationKit | ||
import SwiftUI | ||
|
||
// MARK: - CaregiverSettingsView.AppearanceRow | ||
|
||
extension CaregiverSettingsView { | ||
struct AppearanceRow: View { | ||
// MARK: Internal | ||
|
||
@Binding var caregiver: Caregiver | ||
|
||
var body: some View { | ||
HStack(spacing: 10) { | ||
Text(l10n.CaregiverSettingsView.AppearanceRow.title) | ||
|
||
Spacer() | ||
|
||
Toggle("", isOn: Binding( | ||
get: { self.styleManager.colorScheme == .dark }, | ||
set: { | ||
self.styleManager.colorScheme = $0 ? .dark : .light | ||
self.caregiver.preferredColorScheme = $0 ? .dark : .light | ||
} | ||
)) | ||
} | ||
} | ||
|
||
// MARK: Private | ||
|
||
@ObservedObject private var styleManager: StyleManager = .shared | ||
} | ||
} | ||
|
||
#Preview { | ||
Form { | ||
CaregiverSettingsView.AppearanceRow(caregiver: .constant(Caregiver())) | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
...LekaApp/Sources/_NEWCodeBase/Views/CaregiverSettingsView/CaregiverSettingsView+l10n.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 @@ | ||
// Leka - iOS Monorepo | ||
// Copyright APF France handicap | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
import LocalizationKit | ||
|
||
// swiftlint:disable line_length nesting | ||
|
||
extension l10n { | ||
enum CaregiverSettingsView { | ||
enum AppearanceRow { | ||
static let title = LocalizedString("caregiver_settings_view.appearance_section.appearance_row.title", value: "Dark mode", comment: "Appearance Row title") | ||
} | ||
|
||
enum AccentColorRow { | ||
static let title = LocalizedString("caregiver_settings_view.appearance_section.accent_color_row.title", value: "Accent Color", comment: "AccentColor Row title") | ||
} | ||
|
||
static let navigationTitle = LocalizedString("caregiver_settings_view.navigation_title", value: "Profil of ", comment: "The navigation title of Caregiver Settings View") | ||
|
||
static let saveButtonLabel = LocalizedString("caregiver_settings_view.save_button_label", value: "Save", comment: "Save button label of Caregiver Settings View") | ||
|
||
static let closeButtonLabel = LocalizedString("caregiver_settings_view.close_button_label", value: "Close", comment: "Close button label of Caregiver Settings View") | ||
} | ||
} | ||
|
||
// swiftlint:enable line_length nesting |
Oops, something went wrong.