Mercurial > public > geoquiz
diff GeoQuiz/Components/AnswerButton.swift @ 20:e281791e0494
finish implementation
author | Dennis C. M. <dennis@denniscm.com> |
---|---|
date | Sun, 23 Oct 2022 11:48:39 +0100 |
parents | GeoQuiz/Components/AnswerButtonHelper.swift@f140bb277c96 |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/GeoQuiz/Components/AnswerButton.swift Sun Oct 23 11:48:39 2022 +0100 @@ -0,0 +1,39 @@ +// +// AnswerButton.swift +// GeoQuiz +// +// Created by Dennis Concepción Martín on 14/9/22. +// + +import SwiftUI + +struct AnswerButton: View { + let name: String + let color: Color + + var body: some View { + RoundedRectangle(cornerRadius: 15) + .foregroundColor(.white) + .overlay( + Text(name) + .font(.title2.bold()) + .foregroundColor(color) + ) + } +} + +struct AnswerButton_Previews: PreviewProvider { + static var previews: some View { + ZStack { + LinearGradient(gradient: .main, startPoint: .top, endPoint: .bottom) + .ignoresSafeArea() + + VStack { + Spacer() + AnswerButton(name: "Madrid", color: .royalLightBlue) + .frame(height: 70) + } + .padding() + } + } +}