//
//  MaintaiBottomView.swift
//  PhoneManager
//
//  Created by edy on 2025/5/13.
//

import UIKit

class MaintaiBottomView: UIView {
    
    @IBOutlet weak var numberL: UILabel!
    
    var isshow:Bool = false
    
    var removeMaintaiBlock:(() ->Void)?
    
    override func awakeFromNib() {
        super.awakeFromNib()
        
    }

    @IBAction func noClick(_ sender: Any) {
        removeMaintaiBlock?()
        disMiss()
    }
    
    override func layoutSubviews() {
        super.layoutSubviews()
        self.setShadow(cornerRadius: 0, sColor: UIColor.colorWithHex(hexStr: "#1475B9"), offset: CGSizeMake(3, -1),opacity: 0.15)
    }
    
    func show(){
        guard isshow == false else{
            return
        }
        isshow = true
        self.frame = CGRect(x: self.x, y: self.y, width: self.width, height: self.height)
        UIView.animate(withDuration: 0.2) {
            self.frame = CGRect(x: self.x, y: self.y - self.height, width: self.width, height: self.height)
        }
    }
    
    func disMiss(){
        guard isshow else{
            return
        }
        isshow = false
        UIView.animate(withDuration: 0.2) {
            self.frame = CGRect(x: self.x, y: self.y + self.height, width: self.width, height: self.height)
        }completion: { _ in
            self.removeFromSuperview()
        }
    }
    
}
