diff --git a/DouShouQi_App/DouShouQi_App/Components/MainMenuButton.swift b/DouShouQi_App/DouShouQi_App/Components/MainMenuButton.swift index 444bb42..4ccbe7a 100644 --- a/DouShouQi_App/DouShouQi_App/Components/MainMenuButton.swift +++ b/DouShouQi_App/DouShouQi_App/Components/MainMenuButton.swift @@ -25,24 +25,25 @@ struct MainMenuButton: View { var bottomRightCorner: CGFloat = 0 var body: some View { - Button(text.uppercased()) { - //playSound(named: sound) - if let onClick: () -> Void { - onClick() - } + Button(action: { + // playSound(named: sound) + onClick?() + }) { + Text(text.uppercased()) + .font(.headline) + .fontWeight(.semibold) + .foregroundColor(.white) + .padding() + .frame(maxWidth: .infinity, maxHeight: 40) + .background( + Color.red + .clipShape(RoundedRectangle(cornerSize: CGSize(width: 0, height: 0))) + .mask(RoundedCornersShape(cornerRadii: (topLeft: topLeftCorner, topRight: topRightCorner, bottomLeft: bottomLeftCorner, bottomRight: bottomRightCorner))) + ) + .frame(width: UIScreen.main.bounds.width / 1.7) + .frame(maxWidth: .infinity, alignment: horizontalAlignment) } - .font(.headline) - .fontWeight(.semibold) - .foregroundColor(.white) - .padding() - .frame(maxWidth: .infinity, maxHeight: 40) - .background( - Color.red - .clipShape(RoundedRectangle(cornerSize: CGSize(width: 0, height: 0))) - .mask(RoundedCornersShape(cornerRadii: (topLeft: topLeftCorner, topRight: topRightCorner, bottomLeft: bottomLeftCorner, bottomRight: bottomRightCorner))) - ) - .frame(width: UIScreen.main.bounds.width / 1.7) - .frame(maxWidth: .infinity, alignment: horizontalAlignment) + .buttonStyle(PlainButtonStyle()) } }