From 27ce7fe916d6ce2e40c8874d9a35541eac7cef06 Mon Sep 17 00:00:00 2001 From: Thomas Ricouard Date: Sun, 7 Jan 2024 09:47:55 +0100 Subject: [PATCH] Editor toolbar icons --- .../Sources/StatusKit/Editor/EditorView.swift | 45 ++++++++++--------- .../StatusKit/Editor/ToolbarItems.swift | 7 +-- 2 files changed, 27 insertions(+), 25 deletions(-) diff --git a/Packages/StatusKit/Sources/StatusKit/Editor/EditorView.swift b/Packages/StatusKit/Sources/StatusKit/Editor/EditorView.swift index 0ae2d826..061c0feb 100644 --- a/Packages/StatusKit/Sources/StatusKit/Editor/EditorView.swift +++ b/Packages/StatusKit/Sources/StatusKit/Editor/EditorView.swift @@ -53,7 +53,6 @@ extension StatusEditor { Divider() } - .opacity(editorFocusState == assignedFocusState ? 1 : 0.6) } #if !os(visionOS) .background(theme.primaryBackgroundColor) @@ -158,31 +157,33 @@ extension StatusEditor { private var characterCountAndLangView: some View { let value = (currentInstance.instance?.configuration?.statuses.maxCharacters ?? 500) + viewModel.statusTextCharacterLength HStack(alignment: .center) { - LangButton(viewModel: viewModel) - .padding(.leading, .layoutPadding) - - Button { - withAnimation { - viewModel.showPoll.toggle() - viewModel.resetPollDefaults() + if editorFocusState == assignedFocusState { + LangButton(viewModel: viewModel) + .padding(.leading, .layoutPadding) + + Button { + withAnimation { + viewModel.showPoll.toggle() + viewModel.resetPollDefaults() + } + } label: { + Image(systemName: viewModel.showPoll ? "chart.bar.fill" : "chart.bar") } - } label: { - Image(systemName: viewModel.showPoll ? "chart.bar.fill" : "chart.bar") - } - .buttonStyle(.bordered) - .accessibilityLabel("accessibility.editor.button.poll") - .disabled(viewModel.shouldDisablePollButton) + .buttonStyle(.bordered) + .accessibilityLabel("accessibility.editor.button.poll") + .disabled(viewModel.shouldDisablePollButton) - Button { - withAnimation { - viewModel.spoilerOn.toggle() + Button { + withAnimation { + viewModel.spoilerOn.toggle() + } + isSpoilerTextFocused = viewModel.id + } label: { + Image(systemName: viewModel.spoilerOn ? "exclamationmark.triangle.fill" : "exclamationmark.triangle") } - isSpoilerTextFocused = viewModel.id - } label: { - Image(systemName: viewModel.spoilerOn ? "exclamationmark.triangle.fill" : "exclamationmark.triangle") + .buttonStyle(.bordered) + .accessibilityLabel("accessibility.editor.button.spoiler") } - .buttonStyle(.bordered) - .accessibilityLabel("accessibility.editor.button.spoiler") Spacer() diff --git a/Packages/StatusKit/Sources/StatusKit/Editor/ToolbarItems.swift b/Packages/StatusKit/Sources/StatusKit/Editor/ToolbarItems.swift index 83ffc318..92da1ed1 100644 --- a/Packages/StatusKit/Sources/StatusKit/Editor/ToolbarItems.swift +++ b/Packages/StatusKit/Sources/StatusKit/Editor/ToolbarItems.swift @@ -31,7 +31,7 @@ extension StatusEditor { Button { isDraftsSheetDisplayed = true } label: { - Text("status.editor.drafts.navigation-title") + Image(systemName: "pencil.and.list.clipboard") } .accessibilityLabel("accessibility.editor.button.drafts") .popover(isPresented: $isDraftsSheetDisplayed) { @@ -57,7 +57,8 @@ extension StatusEditor { } } } label: { - Text("status.action.post").bold() + Image(systemName: "paperplane.fill") + .bold() } .buttonStyle(.borderedProminent) .disabled(!mainSEVM.canPost || mainSEVM.isPosting) @@ -77,7 +78,7 @@ extension StatusEditor { object: nil) } } label: { - Text("action.cancel") + Image(systemName: "xmark") } .keyboardShortcut(.cancelAction) .confirmationDialog(