Skip to content
Snippets Groups Projects
TermsConditionsView.swift 1.73 KiB
Newer Older
Bruno Muniz's avatar
Bruno Muniz committed
import UIKit
import Shared

final class TermsConditionsView: UIView {
    let nextButton = CapsuleButton()
    let logoImageView = UIImageView()
Bruno Muniz's avatar
Bruno Muniz committed
    let showTermsButton = CapsuleButton()
    let radioComponent = RadioTextComponent()

    init() {
        super.init(frame: .zero)
        backgroundColor = Asset.neutralWhite.color

        logoImageView.contentMode = .center
        logoImageView.image = Asset.onboardingLogoStart.image
Bruno Muniz's avatar
Bruno Muniz committed
        radioComponent.titleLabel.text = Localized.Terms.radio

        nextButton.isEnabled = false
        nextButton.set(style: .white, title: Localized.Terms.accept)
        showTermsButton.set(style: .seeThroughWhite, title: Localized.Terms.show)
        addSubview(logoImageView)
Bruno Muniz's avatar
Bruno Muniz committed
        addSubview(nextButton)
        addSubview(radioComponent)
        addSubview(showTermsButton)

        setupConstraints()
    }

    required init?(coder: NSCoder) { nil }

    private func setupConstraints() {
        logoImageView.snp.makeConstraints {
Bruno Muniz's avatar
Bruno Muniz committed
            $0.top.equalTo(safeAreaLayoutGuide).offset(30)
            $0.centerX.equalToSuperview()
Bruno Muniz's avatar
Bruno Muniz committed
        }

        radioComponent.snp.makeConstraints {
            $0.left.equalToSuperview().offset(40)
            $0.right.equalToSuperview().offset(-40)
            $0.bottom.equalTo(nextButton.snp.top).offset(-20)
        }

        nextButton.snp.makeConstraints {
            $0.left.equalToSuperview().offset(40)
            $0.right.equalToSuperview().offset(-40)
            $0.bottom.equalTo(showTermsButton.snp.top).offset(-10)
        }

        showTermsButton.snp.makeConstraints {
            $0.left.equalToSuperview().offset(40)
            $0.right.equalToSuperview().offset(-40)
            $0.bottom.equalTo(safeAreaLayoutGuide).offset(-40)
        }
    }
}