Skip to content

Commit 496fcf2

Browse files
committed
Update UI
1 parent 521908e commit 496fcf2

File tree

2 files changed

+41
-6
lines changed

2 files changed

+41
-6
lines changed

PG5602_H24-4/Views/ArticleView/ArticleNote.swift

+11-6
Original file line numberDiff line numberDiff line change
@@ -13,23 +13,26 @@ struct ArticleNote: View {
1313

1414
var body: some View {
1515
NavigationStack {
16-
VStack(alignment: .leading, spacing: 20) {
16+
VStack(alignment: .leading, spacing: 10) {
1717

1818
Text("Add Note for:")
1919
.font(.headline)
20+
.foregroundStyle(.black)
2021
.padding(.top)
2122

2223
Text(article.title)
2324
.font(.subheadline)
24-
.foregroundStyle(.secondary)
25+
.foregroundStyle(.black)
2526
.lineLimit(2)
2627
.padding(.bottom)
2728

28-
2929
TextField("Enter note here...", text: $noteText)
30-
.textFieldStyle(RoundedBorderTextFieldStyle())
30+
.padding()
31+
.background(Color.gray.opacity(0.2))
32+
.foregroundStyle(.black)
33+
.clipShape(RoundedRectangle(cornerRadius: 8))
3134
.padding(.horizontal)
32-
35+
3336
Spacer()
3437

3538
Button(action: onSave) {
@@ -38,12 +41,14 @@ struct ArticleNote: View {
3841
.padding()
3942
.background(Color.blue)
4043
.foregroundStyle(.white)
41-
.cornerRadius(10)
44+
.clipShape(RoundedRectangle(cornerRadius: 8))
4245
.padding(.horizontal)
4346
}
4447
}
48+
4549
.padding()
4650
.navigationTitle("Add Note")
51+
.noteBackground()
4752
}
4853
}
4954
}
+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
//
2+
// View+Background.swift
3+
// PG5602_H24-4
4+
//
5+
//
6+
7+
import SwiftUI
8+
9+
struct NoteBackground: ViewModifier {
10+
func body(content: Content) -> some View {
11+
content
12+
.frame(maxWidth: .infinity, maxHeight: .infinity)
13+
.background(LinearGradient(gradient: Gradient(colors: [.blue, .white, .pink]), startPoint: .topLeading, endPoint: .bottomTrailing)
14+
)
15+
}
16+
}
17+
18+
extension View {
19+
func noteBackground() -> some View {
20+
self.modifier(NoteBackground())
21+
}
22+
}
23+
24+
25+
#Preview {
26+
VStack {
27+
Text("Hello, World!")
28+
}
29+
.noteBackground()
30+
}

0 commit comments

Comments
 (0)