interface PageHeaderProps {
    title: string;
    breadcrumb: any[];
    homeUrl?: string;
}

export const PageHeader = ({title, breadcrumb, homeUrl}: PageHeaderProps) => {
    return (
        <div className="content_title">
            <div className="left">
                <h3>{title}</h3>
            </div>
            <div className="right">
                <ol className="breadcrumb">
                    <li>
                        <a href={homeUrl || "/cmm/main/mainPage.do"} className="home">
                            <i></i>
                        </a>
                    </li>
                    {breadcrumb.map((item, idx) => {
                        const isLast = idx === breadcrumb.length - 1;

                        return (
                            <li key={idx}>
                                {isLast ? (
                                    <strong className="current_location">
                                        {item.label}
                                    </strong>
                                ) : (
                                    <a href={item.url || "#"}>{item.label}</a>
                                )}
                            </li>
                        );
                    })}
                </ol>
            </div>
        </div>
    );
}
