-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
851f940
commit c5b6c1e
Showing
3 changed files
with
157 additions
and
67 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
58 changes: 58 additions & 0 deletions
58
CodeEdit/Features/Settings/Pages/ThemeSettings/ThemeSearchField.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,58 @@ | ||
// | ||
// ThemeSearchField.swift | ||
// CodeEdit | ||
// | ||
// Created by Tommy Ludwig on 30.08.24. | ||
// | ||
|
||
import SwiftUI | ||
|
||
struct ThemeSearchField: View { | ||
@Binding var themeSearchQuery: String | ||
var body: some View { | ||
VStack { | ||
HStack(alignment: .top) { | ||
Image(systemName: "magnifyingglass") | ||
.padding(.leading, 2) | ||
.padding(.trailing, -7) | ||
|
||
TextField("", text: $themeSearchQuery) | ||
.textFieldStyle(PlainTextFieldStyle()) | ||
.multilineTextAlignment(.leading) | ||
.overlay { | ||
HStack { | ||
Text("Search") | ||
.foregroundStyle(.secondary) | ||
.opacity(themeSearchQuery.isEmpty ? 1 : 0) | ||
.padding(.leading, 6.5) | ||
|
||
Spacer() | ||
} | ||
} | ||
} | ||
.padding(3) | ||
.overlay( | ||
RoundedRectangle(cornerRadius: 5) | ||
.foregroundStyle(.secondary) | ||
// .blendMode(.overlay) | ||
.blendMode(.difference) | ||
.opacity(0.1) | ||
) | ||
.overlay { | ||
RoundedRectangle(cornerRadius: 5) | ||
.stroke(Color.gray, lineWidth: 1) | ||
.foregroundStyle(.secondary) | ||
.opacity(0.2) | ||
} | ||
// TextField(text: $themeSearchQuery, prompt: Text("Search")) { | ||
// Label("Test", systemImage: "magnifyingglass") | ||
// } | ||
// .textFieldStyle(.roundedBorder) | ||
// .padding() | ||
} | ||
} | ||
} | ||
|
||
#Preview { | ||
ThemeSearchField(themeSearchQuery: .constant("Test")) | ||
} |
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