From 220c8050b1f50f1a12a7ce0eacece82afb8b8f06 Mon Sep 17 00:00:00 2001 From: Shadowfacts Date: Sun, 13 Nov 2022 14:15:44 -0500 Subject: [PATCH] Re-add pointer effects to Compose toolbar buttons --- .../Screens/Compose/ComposeEmojiTextField.swift | 1 + Tusker/Screens/Compose/ComposeToolbar.swift | 16 ++++++++++++---- Tusker/Views/MenuPicker.swift | 1 + 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/Tusker/Screens/Compose/ComposeEmojiTextField.swift b/Tusker/Screens/Compose/ComposeEmojiTextField.swift index 6d363ec7..add3b4d1 100644 --- a/Tusker/Screens/Compose/ComposeEmojiTextField.swift +++ b/Tusker/Screens/Compose/ComposeEmojiTextField.swift @@ -120,6 +120,7 @@ struct ComposeEmojiTextField: UIViewRepresentable { } func textFieldDidEndEditing(_ textField: UITextField) { + uiState.currentInput = nil updateAutocompleteState(textField: textField) didEndEditing?() } diff --git a/Tusker/Screens/Compose/ComposeToolbar.swift b/Tusker/Screens/Compose/ComposeToolbar.swift index 32d869c7..8cecb2e6 100644 --- a/Tusker/Screens/Compose/ComposeToolbar.swift +++ b/Tusker/Screens/Compose/ComposeToolbar.swift @@ -26,22 +26,24 @@ struct ComposeToolbar: View { var body: some View { ScrollView(.horizontal, showsIndicators: false) { - HStack(spacing: 8) { + HStack(spacing: 0) { Button("CW") { draft.contentWarningEnabled.toggle() } .accessibilityLabel(draft.contentWarningEnabled ? "Remove content warning" : "Add content warning") + .padding(5) + .hoverEffect() MenuPicker(selection: $draft.visibility, options: Self.visibilityOptions, buttonStyle: .iconOnly) - // the button has a bunch of extra space by default, but combined with what we add it's too much - .padding(.horizontal, -8) +// // the button has a bunch of extra space by default, but combined with what we add it's too much +// .padding(.horizontal, -8) if mastodonController.instanceFeatures.localOnlyPosts { MenuPicker(selection: $draft.localOnly, options: [ .init(value: true, title: "Local-only", subtitle: "Only \(mastodonController.accountInfo!.instanceURL.host!)", image: UIImage(named: "link.broken")), .init(value: false, title: "Federated", image: UIImage(systemName: "link")) ], buttonStyle: .iconOnly) - .padding(.horizontal, -8) +// .padding(.horizontal, -8) } if let currentInput = uiState.currentInput, currentInput.toolbarElements.contains(.emojiPicker) { @@ -50,6 +52,8 @@ struct ComposeToolbar: View { } .labelStyle(.iconOnly) .font(.system(size: imageSize)) + .padding(5) + .hoverEffect() } if let currentInput = uiState.currentInput, @@ -68,6 +72,8 @@ struct ComposeToolbar: View { } } .accessibilityLabel(format.accessibilityLabel) + .padding(5) + .hoverEffect() } } @@ -76,6 +82,8 @@ struct ComposeToolbar: View { Button(action: self.draftsButtonPressed) { Text("Drafts") } + .padding(5) + .hoverEffect() } .padding(.horizontal, 16) .frame(minWidth: minWidth) diff --git a/Tusker/Views/MenuPicker.swift b/Tusker/Views/MenuPicker.swift index f452b5df..539c816f 100644 --- a/Tusker/Views/MenuPicker.swift +++ b/Tusker/Views/MenuPicker.swift @@ -44,6 +44,7 @@ struct MenuPicker: UIViewRepresentable { } }) button.accessibilityLabel = selectedOption.accessibilityLabel ?? selectedOption.title + button.isPointerInteractionEnabled = buttonStyle == .iconOnly } struct Option {