|
|
|
@ -13,6 +13,15 @@ struct MainMenuButton: View {
|
|
|
|
|
var text: String
|
|
|
|
|
@State private var isHovered: Bool = false
|
|
|
|
|
|
|
|
|
|
// Button Alignment
|
|
|
|
|
var horizontalAlignment: Alignment = .center
|
|
|
|
|
|
|
|
|
|
// Button corner radius
|
|
|
|
|
var topLeftCorner: CGFloat = 0
|
|
|
|
|
var topRightCorner: CGFloat = 0
|
|
|
|
|
var bottomLeftCorner: CGFloat = 0
|
|
|
|
|
var bottomRightCorner: CGFloat = 0
|
|
|
|
|
|
|
|
|
|
var body: some View {
|
|
|
|
|
Button(action: {
|
|
|
|
|
// Action du bouton
|
|
|
|
@ -26,11 +35,11 @@ struct MainMenuButton: View {
|
|
|
|
|
.background(
|
|
|
|
|
Colors.Button
|
|
|
|
|
.clipShape(RoundedRectangle(cornerSize: CGSize(width: 0, height: 0)))
|
|
|
|
|
.mask(RoundedCornersShape(cornerRadii: (topLeft: 0, topRight: 10, bottomLeft: 0, bottomRight: 10)))
|
|
|
|
|
.mask(RoundedCornersShape(cornerRadii: (topLeft: topLeftCorner, topRight: topRightCorner, bottomLeft: bottomLeftCorner, bottomRight: bottomRightCorner)))
|
|
|
|
|
)
|
|
|
|
|
})
|
|
|
|
|
.frame(width: UIScreen.main.bounds.width / 1.7)
|
|
|
|
|
.frame(maxWidth: .infinity, alignment: .leading)
|
|
|
|
|
.frame(maxWidth: .infinity, alignment: horizontalAlignment)
|
|
|
|
|
.scaleEffect(isHovered ? 1.1 : 1.0)
|
|
|
|
|
.animation(.easeInOut(duration: 0.2), value: isHovered)
|
|
|
|
|
.onHover { hovering in
|
|
|
|
@ -85,6 +94,6 @@ struct RoundedCornersShape: Shape {
|
|
|
|
|
|
|
|
|
|
struct MainMenuButton_Previews: PreviewProvider {
|
|
|
|
|
static var previews: some View {
|
|
|
|
|
MainMenuButton(text: "test")
|
|
|
|
|
MainMenuButton(text: "test", horizontalAlignment: .leading, topRightCorner: 10, bottomRightCorner: 10)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|