//
//  MPPositive_LoveArtistTableViewCell.swift
//  MusicPlayer
//
//  Created by Mr.Zhou on 2024/5/28.
//

import UIKit

class MPPositive_LoveArtistTableViewCell: UITableViewCell {
    //特殊图片（展示预览图片）
    private lazy var iconImageView:UIImageView = {
        let imageView:UIImageView = .init()
        imageView.contentMode = .scaleAspectFill
        imageView.layer.masksToBounds = true
        return imageView
    }()
    private lazy var titleLabel:UILabel = createLabel(font: .systemFont(ofSize: 14*width, weight: .medium), textColor: .white, textAlignment: .left)
    var artistViewModel:MPPositive_CollectionArtistViewModel!{
        didSet{
            artistViewModel.setImage(iconImageView)
            titleLabel.text = artistViewModel.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()
        // Initialization code
    }
    
    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.width.height.equalTo(50*width)
            make.top.equalToSuperview().offset(8*width).priority(999)
            make.bottom.equalToSuperview().offset(-8*width)
            make.left.equalToSuperview().offset(18*width)
        }
        contentView.addSubview(titleLabel)
        titleLabel.snp.makeConstraints { make in
            make.top.equalTo(iconImageView.snp.top).offset(10*width)
            make.left.equalTo(iconImageView.snp.right).offset(12*width)
            make.right.equalToSuperview().offset(-12*width)
        }
    }

}
