"use client";
import { FC, PropsWithChildren, ReactNode } from "react";
import clsx from "clsx";
import styles from "./style.module.scss";

/**
 * @description 自定义头部返回组件
 * @param {string} title header标题
 * @param {ReactNode} children 插槽内容
 * @param {() => ReactNode} headerRender 自定义渲染
 */

export interface HeaderBackProps {
    title?: string;
    children?: ReactNode;
    headerRender?: () => ReactNode;
}

const HeaderBack: FC<PropsWithChildren<HeaderBackProps>> = ({title = '', children}) => {
    const icon1 = clsx({
        [styles.iconfontIcon1]: true,
    },'iconfont icon-xiangzuo1');
    const icon2 = clsx({
        [styles.iconfontIcon2]: true,
    },'iconfont icon-company_nav_icon_home');
    return (
        <div className={styles.headerBack}>
            <div className={styles.left}>
                <span className={icon1}></span>
            </div>
            {title && <span className={styles.title}>{title}</span>}
            {children}
            <span className={styles.right}>
                <span className={icon2}></span>
            </span>
        </div>
    );
};

export default HeaderBack;
