Commit 59375d7b authored by mxm-web-develop's avatar mxm-web-develop

321

parent 78d498f5
......@@ -98,8 +98,15 @@ const HoverLink = (props: HoverLinkType) => {
export default function Navbar(props: IAppProps) {
const { pathname } = useLocation();
const { data } = React.useContext(AppContext);
const navigate = useNavigate()
// console.log('nav',data)
const navigate = useNavigate();
const navbarWithBg = useCallback(()=>{
if(pathname.includes('/news/')){
return true
}
return false;
},[pathname])
const themeStyle = useCallback(
(theme: string, active: boolean) => {
if (theme === "light") {
......@@ -118,9 +125,21 @@ export default function Navbar(props: IAppProps) {
);
return (
<>
<nav className="invisible moblie:visible flex min-w-[1440px] justify-between absolute px-[120px] w-full top-0 z-[99999] py-6 text-sm text-[#061E3B] font-normal ">
<nav
className={`invisible moblie:visible flex min-w-[1440px]
justify-between absolute px-[120px] w-full items-center
top-0 z-[99999] py-6 text-sm text-[#061E3B] font-normal
${navbarWithBg()?' bg-white':' bg-none'}
`}
>
<div className="left ">
<img src={data.theme === "dark" || pathname ==='/news'? LogoWhite:Logo } onClick={()=>navigate('/')} className=" cursor-pointer"/>
<img
src={
data.theme === "dark" || pathname === "/news" ? LogoWhite : Logo
}
onClick={() => navigate("/")}
className=" cursor-pointer"
/>
</div>
<div className="right content-1-cn items-start flex gap-x-12">
<Link
......
......@@ -38,19 +38,20 @@ const AppReducer = (state:typeof data,action:Actions)=>{
export const AppProvider = (props: any)=>{
const [state,dispatch] = useReducer(AppReducer,data)
const location = useLocation()
const ob = fromEvent(window,'resize')
useEffect(()=>{
dispatch({type:'routerOnChange',payload:{currentPage:location.pathname}})
dispatch({type:'slideOnChange',payload:{pageIndex:0}})
},[location])
useEffect(()=>{
const ob = fromEvent(window,'resize')
ob.subscribe(v=>{
const target = v.currentTarget
if(target){
console.log(target);
// ob.subscribe(v=>{
// const target = v.currentTarget
// if(target){
// console.log(target);
}
})
// }
// })
})
return(
<AppContext.Provider value={{data:state,dispatch}}>
......
......@@ -48,7 +48,12 @@ export const NewsDetails = (props:NewsDetailsType)=>{
<PageLayout className=" overflow-y-scroll">
<AppContianer>
<>
<div className="flex">
<div className="w-2/12"></div>
<div className='title-1-cn '>{data&&data.title}</div>
<div className='w-[370px]'></div>
</div>
<div className="flex normal-text ">
<div className="w-2/12 pt-[35px]">
<div className='flex-col pr-5 text-center '>
......@@ -71,7 +76,7 @@ export const NewsDetails = (props:NewsDetailsType)=>{
</div>
<div >
<div className='richRender pt-5 px-20 pb-24'>
<div className='title-1-cn py-[24px]'>{data&&data.title}</div>
<div dangerouslySetInnerHTML={{__html:data&&data.content}} className="py-5"></div>
</div>
</div>
......@@ -81,7 +86,7 @@ export const NewsDetails = (props:NewsDetailsType)=>{
<div>
{
latestNews&&latestNews.map((k:any,index:number)=>(
<div key={index} onClick={()=>navigate(`/news/${k.id}`)} className="pb-[21px] w-[370px] normal-content cursor-pointer hover:text-theme-blue">
<div key={index} onClick={()=>navigate(`/news/${k.id}`)} className="pb-[21px] w-[30px] normal-content cursor-pointer hover:text-theme-blue">
<div>{k.title}</div>
<div>{useDate(data&&data.time_stamp).year}/{useDate(data&&data.time_stamp).month}/{useDate(data&&data.time_stamp).day}</div>
</div>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment