Skip to content

Commit

Permalink
size of green play button in Home to be dynamic
Browse files Browse the repository at this point in the history
  • Loading branch information
Lee Jun Kit committed Jun 20, 2021
1 parent b5a7da7 commit aaad352
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Spottie/Views/Components/CarouselRowItem.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ struct CarouselRowItem: View {
.aspectRatio(1.0, contentMode: .fill)
.cornerRadius(5)
}
GreenPlayButton {
GreenPlayButton(width: 48) {
onPlayButtonPressed()
}
.offset(x: -16, y: -16)
Expand Down
5 changes: 3 additions & 2 deletions Spottie/Views/Components/GreenPlayButton.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import SwiftUI

struct GreenPlayButton: View {
var width: CGFloat
var onPress: () -> Void

@State private var isHovering = false
Expand All @@ -16,7 +17,7 @@ struct GreenPlayButton: View {
Button(action: onPress) {
Image(systemName: "play.circle.fill")
.resizable()
.frame(width: 32, height: 32)
.frame(width: width, height: width)
.foregroundColor(.green)
.background(Color.white)
}
Expand All @@ -32,7 +33,7 @@ struct GreenPlayButton: View {

struct GreenPlayButton_Previews: PreviewProvider {
static var previews: some View {
GreenPlayButton {
GreenPlayButton(width: 32) {

}
}
Expand Down
1 change: 1 addition & 0 deletions Spottie/Views/Components/ShortcutItem.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ struct ShortcutItem: View {
.padding(.leading)
Spacer()
GreenPlayButton(
width: 32,
onPress: onPlayButtonPressed
)
.padding(.trailing)
Expand Down

0 comments on commit aaad352

Please sign in to comment.