//
//  CapsuleViewModifier.swift
//  PadelClub
//
//  Created by Laurent Morvillier on 17/07/2024.
//

import Foundation
import SwiftUI

struct CapsuleViewModifier: ViewModifier {
    
    let foreground: Color
    let background: Color

    func body(content: Content) -> some View {
        content
            .foregroundStyle(self.foreground)
            .font(.footnote)
            .padding(.horizontal, 8.0)
            .padding(.vertical, 4.0)
            .background(self.background)
            .clipShape(RoundedRectangle(cornerRadius: 8.0, style: .circular))

    }
}

extension View {
    func capsule(foreground: Color, background: Color) -> some View {
        modifier(CapsuleViewModifier(foreground: foreground, background: background))
    }
}
