SwiftUIの練習がてらスケッチしてみる。
こういうやつ
https://api.slack.com/docs/sign-in-with-slack
struct SignInWithSlackButton: View {
let action: () -> Void
var body: some View {
Button(action: action) {
HStack(alignment: .center) {
Image("Slack")
.renderingMode(.original)
.resizable()
.frame(width: 24, height: 24, alignment: .center)
HStack(spacing: 0) {
Text("Sign in with ")
Text("Slack").fontWeight(.bold)
}
}.padding(EdgeInsets(top: 6, leading: 8, bottom: 6, trailing: 8)).overlay(
RoundedRectangle(cornerRadius: 6)
.stroke(Color.secondary, style: StrokeStyle(lineWidth: 1))
).foregroundColor(Color.primary)
}
}
}
もやもやするところ
- 文字サイズ大きい時は画像も大きくしたい
- 文字途中で太字にするのはHStackでいいのかな