import { useLocation, useNavigate } from "react-router-dom";
import useScrollToTop from "../../Hook/useScrollToTop";


/**
 * 详情
 * @returns 
 */
const Article: React.FC = () => {

    useScrollToTop();
    
    /***********************************/
    const navigate = useNavigate();
    const location = useLocation();
    const { post_title, post_date, post_url } = location.state || {};
    /***********************************/

    return <div className="news">
        <div className="bg-box" style={{ height: '100%'}}>
            <div className="bg bg-top"></div>
            <div className="bg bg-btm"></div>
        </div>
        <div className="mainbody">
            <div className="age-tip"></div>
            <div className="news-nav">
                <div className="location-box">
                    <a className="goback" onClick={() => navigate(-1)}></a>
                </div>
            </div>
            <div className="article-box">
                <div className="article-tit">
                    <h1>{post_title}</h1>
                    <p>{post_date}</p>
                </div>
                <div dangerouslySetInnerHTML={{ __html: post_url }} />
            </div>
        </div>
    </div>
}

export default Article