//
//  YHServerTableHeadView.swift
//  galaxy
//
//  Created by EDY on 2024/4/8.
//  Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//

import UIKit

class YHServerTableHeadView: UIView {
//    var search: YHHomeSearchView!
    
//    static let viewH : CGFloat = 365.0 - 36.0
    
    static let viewH : CGFloat = 8 + 235 + 32 + 25 + 10
    
    var bannarView: YHServiceBannerView!
    var titleLabel: UILabel!

    var dataSource: YHScemeHeadModel? {
        didSet {
//            updateAllViews()
        }
    }
//    var searchPlaceHolder:String = "" {
//        didSet {
//            search.placeHolder = searchPlaceHolder
//        }
//    }
    override init(frame: CGRect) {
        super.init(frame: frame)
        backgroundColor = .white
        setUpView()
    }
    
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    func setUpView() {
//        search = {
//            let view = YHHomeSearchView()
//            let tap = UITapGestureRecognizer(target: self, action: #selector(didSearchBarClicked))
//            view.addGestureRecognizer(tap)
//            return view
//        }()
//        addSubview(search)
//        search.snp.makeConstraints { make in
//            make.top.equalTo(6)
//            make.left.equalTo(20)
//            make.right.equalTo(-20)
//            make.height.equalTo(36)
//        }
        
        bannarView = {
            let view = YHServiceBannerView()
            return view
        }()
        addSubview(bannarView)
        bannarView.snp.makeConstraints { make in
            make.top.equalToSuperview()
            make.height.equalTo(235)
            make.left.right.equalToSuperview()
        }
        
        titleLabel = {
            let label = UILabel()
            label.font = UIFont.PFSC_B(ofSize: 18)
            label.textColor = UIColor.mainTextColor
            label.textAlignment = .left
            label.text = "香港生活攻略"
            return label
        }()
        addSubview(titleLabel)
        titleLabel.snp.makeConstraints { make in
            make.bottom.equalTo(-10)
            make.height.equalTo(25)
            make.left.equalTo(20)
        }
    }
    
//    func updateAllViews() {
//        guard let model = dataSource else { return }
//    }
    
    
//    @objc func goNext() {
//        UIViewController.current?.navigationController?.pushViewController(YHScoreDetailViewController())
//    }
    
//    @objc func didSearchBarClicked() {
//        let vc = YHSearchInfomationVC()
////        vc.searchPlaceHolder = self.searchPlaceHolder
////        printLog("placeHolder: \(searchPlaceHolder)")
//        UIViewController.current?.navigationController?.pushViewController(vc)
//    }
}
