//
//  YHPersonInfoCellView.swift
//  galaxy
//
//  Created by davidhuangA on 2024/1/30.
//  Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//

import UIKit
class YHPersonInfoCellView: UIView {
    override init(frame: CGRect) {
        super.init(frame: frame)
        setupUI()
    }
    
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
   
    //title
    private lazy var nameLable : UILabel = {
        let lable0 = UILabel(text: "--")
        lable0.textColor = UIColor(hex: 0x888F98)
        lable0.font = UIFont.PFSC_R(ofSize: 14)
        lable0.numberOfLines = 0
        lable0.lineBreakMode = .byCharWrapping
        return lable0
    }()
    
    
    //title
    private lazy var subtitleLable : UILabel = {
        let lable0 = UILabel(text: "--")
        lable0.textColor = UIColor(hex: 0x222222)
        lable0.font = UIFont.PFSC_R(ofSize: 14)
        lable0.numberOfLines = 0
        lable0.lineBreakMode = .byWordWrapping
        lable0.textAlignment = .right
        return lable0
    }()
    
    private func setupUI() {
        addSubview(nameLable)
        nameLable.snp.makeConstraints { make in
            make.top.equalToSuperview().offset(18)
            make.left.equalToSuperview()
            make.width.lessThanOrEqualTo(154)
            make.height.equalTo(17)
        }
        nameLable.setContentCompressionResistancePriority(.required, for: .horizontal)
        
        addSubview(subtitleLable)
        subtitleLable.snp.makeConstraints { make in
            make.top.equalTo(nameLable.snp.top)
            make.right.equalToSuperview()
            make.left.equalTo(nameLable.snp.right).offset(10)
            make.bottom.equalToSuperview()
        }
    }
}

extension YHPersonInfoCellView {
    func update(title : String,subtitle : String) {
        nameLable.text = title
        subtitleLable.text = subtitle
    }
}

