Skip to content

Commit

Permalink
Refactor code illustration
Browse files Browse the repository at this point in the history
  • Loading branch information
ludovic35 committed Dec 20, 2024
1 parent 99920d1 commit a14a1fe
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions Showcase/Showcase/Pages/Utils/ShowcaseCode.swift
Original file line number Diff line number Diff line change
Expand Up @@ -66,29 +66,30 @@ struct ShowcaseCode: View {
}

private func codeTokenDisplayCodeSection() -> some View {
HStack(alignment: .firstTextBaseline, spacing: theme.spaces.spacePaddingBlockMedium) {
HStack(alignment: .firstTextBaseline, spacing: theme.spaces.spacePaddingBlockNone) {
Text(code)
.font(.system(.body, design: .monospaced))
.foregroundStyle(theme.colors.colorContentDefault.color(for: colorScheme))
.padding(.vertical, theme.spaces.spacePaddingInlineShort)

Button(action: {
Spacer(minLength: theme.spaces.spacePaddingBlockMedium)

Button {
UIPasteboard.general.string = code
}, label: {
} label: {
ZStack {
Color.clear
.frame(width: 44, height: 44)

Image("ic_copy")
.resizable()
.renderingMode(.template)
.foregroundColor(theme.colors.colorSurfaceStatusPositiveMuted.color(for: colorScheme))
.foregroundColor(theme.colors.colorContentDefault.color(for: colorScheme))
.frame(width: 24, height: 24)
.padding(.trailing, theme.spaces.spacePaddingInlineMedium)
.alignmentGuide(.firstTextBaseline) { $0[.bottom] * 0.7 }
.accessibilityLabel("app_common_copyCode_a11y")
}
})
}
}
.frame(minWidth: 72, maxWidth: .infinity, alignment: .leading)
.padding(.vertical, theme.spaces.spacePaddingInlineShort)
Expand Down

0 comments on commit a14a1fe

Please sign in to comment.