//
//  SQText.swift
//
//
//  Created by Victor on 12/06/2024.
//

import SwiftUI

enum SQTextFont: String {
    case medium = "TTChocolates-Medium"
    case mediumItalic = "TTChocolates-MediumIt"
    case demiBold = "TTChocolates-DemiBold"
    case bold = "TTChocolates-Bold"
    case boldItalic = "TTChocolates-Bold-Italic"
}

struct SQText: View {
    var text: String
    var size: CGFloat
    var font: SQTextFont
    var textColor: Color

    init(_ text: String, size: CGFloat = 16, font: SQTextFont = .medium, textColor: Color = .sqNeutral(90)) {
        self.text = text
        self.size = size
        self.font = font
        self.textColor = textColor
    }

    var body: some View {
        Text(text)
            .font(.custom(font.rawValue, size: size))
            .foregroundStyle(textColor)
    }
}

#Preview {
    VStack(spacing: 10) {
        SQText("Hello world!", font: .medium)
        SQText("Hello world!", font: .mediumItalic)
        SQText("Hello world!", size: 18, font: .demiBold)
        SQText("Hello world!", font: .bold)
        SQText("Hello world!", size: 18, font: .boldItalic)
    }
}
