//
//  QSLHomeCallOutView.swift
//  QuickSearchLocation
//
//  Created by Destiny on 2024/12/6.
//

import UIKit

class MapLocationCalloutView: UIView {
    
    var name: String? {
        didSet {
            nameLabel.text = name
            
            let width = (name?.widthAccording(height: 20.rpx, font: UIFont.textM(14), lineSpacing: 0) ?? 0) + 16.rpx
            self.nameLabel.snp.updateConstraints { make in
                make.width.equalTo(width)
            }
        }
    }
    
    lazy var nameLabel: UILabel = {
       
        let label = UILabel()
        label.textAlignment = .center
        label.backgroundColor = .hexStringColor(hexString: "#000000", alpha: 0.7)
        label.addRadius(radius: 4.rpx)
        label.mediumFont(14)
        label.textColor = .white
        label.text = "11111"
        return label
    }()
    
    override init(frame: CGRect) {
        super.init(frame: frame)
        
        self.addSubview(self.nameLabel)
        self.nameLabel.snp.makeConstraints { make in
            make.center.equalToSuperview()
            make.height.equalTo(20.rpx)
            make.width.equalTo(30.rpx)
        }
    }
    
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
}
