//
//  MPPositive_SearchSuggestionItemTableViewCell.swift
//  MusicPlayer
//
//  Created by Mr.Zhou on 2024/5/12.
//

import UIKit

class MPPositive_SearchSuggestionItemTableViewCell: UITableViewCell {
    //搜索Icon
    private lazy var iconImageView:UIImageView = UIImageView(image: .init(named: "B_Seach"))
    private lazy var titleLabel:UILabel = createLabel(font: .systemFont(ofSize: 12*width, weight: .regular), textColor: .init(hex: "#FFFFFF", alpha: 0.6), textAlignment: .left)
    var item:MPPositive_SearchSuggestionItemModel!{
        didSet{
            titleLabel.text = item.title ?? ""
        }
    }
    override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
        super.init(style: style, reuseIdentifier: reuseIdentifier)
        selectionStyle = .none
        backgroundColor = .clear
        configure()
    }
    
    required init?(coder: NSCoder) {
        super.init(coder: coder)
    }
    override func awakeFromNib() {
        super.awakeFromNib()
    }

    override func setSelected(_ selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)

        // Configure the view for the selected state
    }
    private func configure() {
        contentView.addSubview(iconImageView)
        iconImageView.snp.makeConstraints { make in
            make.left.equalToSuperview().offset(12*width)
            make.width.height.equalTo(30*width)
            make.centerY.equalToSuperview()
        }
        contentView.addSubview(titleLabel)
        titleLabel.snp.makeConstraints { make in
            make.centerY.equalToSuperview()
            make.left.equalTo(iconImageView.snp.right).offset(10*width)
            make.right.equalToSuperview().offset(-12*width)
        }
    }
}
