-
Notifications
You must be signed in to change notification settings - Fork 395
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
perf(UI): redesign settings advanced tab (#540)
* format: setting tabs xcode file order * perf(UI): remove header for advanced tab * perf(UI): add AdvancedTabToggle view * perf: relocate AdvancedTabToggle file * perf: rename AdvancedTabStyle * perf(UI): implement new advanced tab design * perf: clean stale xcstring * perf(UI): adjust corner radius of rectangle * docs: update documentation for AdvancedTabStyle * perf(UI): add optional subtitle to AdvancedTabStyle * perf(UI): adjust en localization * perf: rename AdvancedTabItemView Co-Authored-By: Phillip Song <[email protected]> * format: simplify subtitle optional Co-Authored-By: Phillip Song <[email protected]> * format: color codes in advanced view Co-Authored-By: Phillip Song <[email protected]> * perf(UI): adjust en localization for SwiftUI App mode --------- Co-authored-by: Tisfeng <[email protected]> Co-authored-by: Phillip Song <[email protected]>
- Loading branch information
1 parent
92735ae
commit 1a2f079
Showing
4 changed files
with
88 additions
and
26 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
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,39 @@ | ||
// | ||
// AdvancedTabItemView.swift | ||
// Easydict | ||
// | ||
// Created by Jerry on 2024-05-06. | ||
// Copyright © 2024 izual. All rights reserved. | ||
// | ||
|
||
import SwiftUI | ||
|
||
/// Takes in a Color, a systemImage, a text label, and an optional subtitle to quickly create a toggle or picker style for Advanced Tab in Settings. | ||
struct AdvancedTabItemView: View { | ||
var color: Color | ||
var systemImage: String | ||
var labelText: LocalizedStringKey | ||
var subtitleText: LocalizedStringKey? | ||
|
||
var body: some View { | ||
HStack(spacing: 8) { | ||
Rectangle() | ||
.fill(color) | ||
.frame(width: 20, height: 20, alignment: .center) | ||
.clipShape(RoundedRectangle(cornerRadius: 4)) | ||
.overlay( | ||
Image(systemName: systemImage) | ||
.font(.system(size: 12)) | ||
.foregroundColor(.white) | ||
) | ||
VStack(alignment: .leading) { | ||
Text(labelText) | ||
if let subtitleText { | ||
Text(subtitleText) | ||
.font(.subheadline) | ||
.foregroundColor(.secondary) | ||
} | ||
} | ||
} | ||
} | ||
} |
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