From b048d5d901b0221886f0160963b89a39cfda6ad9 Mon Sep 17 00:00:00 2001 From: Tayeb Sedraia Date: Mon, 25 Nov 2024 13:13:53 +0100 Subject: [PATCH] fix: align code title with text size change --- .../Showcase/Pages/Utils/ShowcaseTokenCode.swift | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/Showcase/Showcase/Pages/Utils/ShowcaseTokenCode.swift b/Showcase/Showcase/Pages/Utils/ShowcaseTokenCode.swift index d540e31bc..1e350d001 100644 --- a/Showcase/Showcase/Pages/Utils/ShowcaseTokenCode.swift +++ b/Showcase/Showcase/Pages/Utils/ShowcaseTokenCode.swift @@ -37,14 +37,13 @@ struct ShowcaseTokenCode: View { // MARK: Private helpers private func toggleButtonSection() -> some View { - HStack { - Button(action: { - isCodeVisible.toggle() - }, label: { + VStack(alignment: .leading, spacing: theme.spaceFixedNone) { + Button(action: toggle) { HStack { Text("app_tokens_code_title_label") .typeBodyStrongLarge(theme) .foregroundStyle(theme.colorContentDefault.color(for: colorScheme)) + .padding(.vertical, theme.spacePaddingInlineShort) Image(isCodeVisible ? "ic_chevron-up" : "ic_chevron-down") .resizable() .renderingMode(.template) @@ -53,10 +52,11 @@ struct ShowcaseTokenCode: View { .padding(.trailing, theme.spacePaddingInlineMedium) .accessibilityLabel("app_tokens_code_visibility_button_a11y") } - }) + } + .buttonStyle(PlainButtonStyle()) } .frame(maxWidth: .infinity, alignment: .leading) - .padding(.bottom, theme.spacePaddingBlockMedium) + .padding(.bottom, theme.spacePaddingBlockShort) } private func codeTokenDisplayCodeSection() -> some View { @@ -100,4 +100,8 @@ struct ShowcaseTokenCode: View { color: theme.colorBorderDefault) ) } + + private func toggle() { + isCodeVisible.toggle() + } }