mirror of
https://github.com/kkebo/DNSecure.git
synced 2026-03-11 08:54:36 +00:00
refactor: refactor Buttons and Menus
This commit is contained in:
parent
41dfa8b900
commit
4bea9abec9
2 changed files with 6 additions and 11 deletions
|
|
@ -305,14 +305,12 @@ extension ContentView: View {
|
||||||
|
|
||||||
@ToolbarContentBuilder private var toolbarContent: some ToolbarContent {
|
@ToolbarContentBuilder private var toolbarContent: some ToolbarContent {
|
||||||
ToolbarItem(placement: .topBarLeading) {
|
ToolbarItem(placement: .topBarLeading) {
|
||||||
Menu {
|
Menu("Add", systemImage: "plus") {
|
||||||
Button("DNS-over-TLS", action: self.addNewDoTServer)
|
Button("DNS-over-TLS", action: self.addNewDoTServer)
|
||||||
Button("DNS-over-HTTPS", action: self.addNewDoHServer)
|
Button("DNS-over-HTTPS", action: self.addNewDoHServer)
|
||||||
Button("Restore from Presets") {
|
Button("Restore from Presets") {
|
||||||
self.isRestoring = true
|
self.isRestoring = true
|
||||||
}
|
}
|
||||||
} label: {
|
|
||||||
Image(systemName: "plus")
|
|
||||||
}
|
}
|
||||||
.sheet(isPresented: self.$isRestoring) {
|
.sheet(isPresented: self.$isRestoring) {
|
||||||
RestorationView(onAdd: self.restoreFromPresets)
|
RestorationView(onAdd: self.restoreFromPresets)
|
||||||
|
|
@ -330,10 +328,8 @@ extension ContentView: View {
|
||||||
Text(self.isEnabled ? "Active" : "Inactive")
|
Text(self.isEnabled ? "Active" : "Inactive")
|
||||||
}
|
}
|
||||||
if !self.isEnabled {
|
if !self.isEnabled {
|
||||||
Button {
|
Button("How to Activate", systemImage: "questionmark.circle") {
|
||||||
self.isGuidePresented = true
|
self.isGuidePresented = true
|
||||||
} label: {
|
|
||||||
Label("How to Activate", systemImage: "questionmark.circle")
|
|
||||||
}
|
}
|
||||||
.labelStyle(.titleAndIcon)
|
.labelStyle(.titleAndIcon)
|
||||||
.font(.caption)
|
.font(.caption)
|
||||||
|
|
|
||||||
|
|
@ -26,13 +26,12 @@ extension LazyTextField: View {
|
||||||
TextField(self.title, text: self.$localText)
|
TextField(self.title, text: self.$localText)
|
||||||
.focused(self.$isFocused)
|
.focused(self.$isFocused)
|
||||||
if self.isFocused && !self.localText.isEmpty {
|
if self.isFocused && !self.localText.isEmpty {
|
||||||
Button {
|
Button("Clear", systemImage: "xmark.circle.fill") {
|
||||||
self.text.removeAll()
|
self.text.removeAll()
|
||||||
} label: {
|
|
||||||
Image(systemName: "xmark.circle.fill")
|
|
||||||
.foregroundStyle(Color.primary)
|
|
||||||
.opacity(0.2)
|
|
||||||
}
|
}
|
||||||
|
.foregroundStyle(Color.primary)
|
||||||
|
.opacity(0.2)
|
||||||
|
.labelStyle(.iconOnly)
|
||||||
.buttonStyle(.borderless)
|
.buttonStyle(.borderless)
|
||||||
.hoverEffect()
|
.hoverEffect()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue