//
//  MPPositive_ChooseNewPlayListTableViewCell.swift
//  relax.offline.mp3.music
//
//  Created by Mr.Zhou on 2024/6/26.
//

import UIKit

class MPPositive_ChooseNewPlayListTableViewCell: UITableViewCell {
    //新增按钮
    private lazy var newBtn:UIButton = {
        let btn = UIButton()
        btn.setTitle("Create PlayList", for: .normal)
        btn.setTitleColor(.white, for: .normal)
        btn.titleLabel?.font = .systemFont(ofSize: 16*width, weight: .medium)
        btn.backgroundColor = .init(hex: "#80F988")
        btn.layer.masksToBounds = true
        btn.layer.cornerRadius = 10*width
        btn.addTarget(self, action: #selector(newClick(_ :)), for: .touchUpInside)
        return btn
    }()
    var newBlock:(() -> Void)?
    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
    }
    private func configure() {
        contentView.addSubview(newBtn)
        newBtn.snp.makeConstraints { make in
            make.top.equalToSuperview().offset(12*width).priority(999)
            make.bottom.equalToSuperview().offset(-12*width)
            make.width.equalTo(140*width)
            make.height.equalTo(35*width)
            make.centerX.equalToSuperview()
        }
    }
    override func setSelected(_ selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)

        // Configure the view for the selected state
    }
    //新增歌单
    @objc private func newClick(_ sender:UIButton) {
        if let block = newBlock {
            block()
        }
    }
}
