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

321

parent 78d498f5
...@@ -98,8 +98,15 @@ const HoverLink = (props: HoverLinkType) => { ...@@ -98,8 +98,15 @@ const HoverLink = (props: HoverLinkType) => {
export default function Navbar(props: IAppProps) { export default function Navbar(props: IAppProps) {
const { pathname } = useLocation(); const { pathname } = useLocation();
const { data } = React.useContext(AppContext); const { data } = React.useContext(AppContext);
const navigate = useNavigate() const navigate = useNavigate();
// console.log('nav',data) const navbarWithBg = useCallback(()=>{
if(pathname.includes('/news/')){
return true
}
return false;
},[pathname])
const themeStyle = useCallback( const themeStyle = useCallback(
(theme: string, active: boolean) => { (theme: string, active: boolean) => {
if (theme === "light") { if (theme === "light") {
...@@ -118,9 +125,21 @@ export default function Navbar(props: IAppProps) { ...@@ -118,9 +125,21 @@ export default function Navbar(props: IAppProps) {
); );
return ( 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 "> <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>
<div className="right content-1-cn items-start flex gap-x-12"> <div className="right content-1-cn items-start flex gap-x-12">
<Link <Link
......
...@@ -38,19 +38,20 @@ const AppReducer = (state:typeof data,action:Actions)=>{ ...@@ -38,19 +38,20 @@ const AppReducer = (state:typeof data,action:Actions)=>{
export const AppProvider = (props: any)=>{ export const AppProvider = (props: any)=>{
const [state,dispatch] = useReducer(AppReducer,data) const [state,dispatch] = useReducer(AppReducer,data)
const location = useLocation() const location = useLocation()
const ob = fromEvent(window,'resize')
useEffect(()=>{ useEffect(()=>{
dispatch({type:'routerOnChange',payload:{currentPage:location.pathname}}) dispatch({type:'routerOnChange',payload:{currentPage:location.pathname}})
dispatch({type:'slideOnChange',payload:{pageIndex:0}}) dispatch({type:'slideOnChange',payload:{pageIndex:0}})
},[location]) },[location])
useEffect(()=>{ useEffect(()=>{
const ob = fromEvent(window,'resize')
ob.subscribe(v=>{ // ob.subscribe(v=>{
const target = v.currentTarget // const target = v.currentTarget
if(target){ // if(target){
console.log(target); // console.log(target);
} // }
}) // })
}) })
return( return(
<AppContext.Provider value={{data:state,dispatch}}> <AppContext.Provider value={{data:state,dispatch}}>
......
...@@ -48,7 +48,12 @@ export const NewsDetails = (props:NewsDetailsType)=>{ ...@@ -48,7 +48,12 @@ export const NewsDetails = (props:NewsDetailsType)=>{
<PageLayout className=" overflow-y-scroll"> <PageLayout className=" overflow-y-scroll">
<AppContianer> <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="flex normal-text ">
<div className="w-2/12 pt-[35px]"> <div className="w-2/12 pt-[35px]">
<div className='flex-col pr-5 text-center '> <div className='flex-col pr-5 text-center '>
...@@ -71,7 +76,7 @@ export const NewsDetails = (props:NewsDetailsType)=>{ ...@@ -71,7 +76,7 @@ export const NewsDetails = (props:NewsDetailsType)=>{
</div> </div>
<div > <div >
<div className='richRender pt-5 px-20 pb-24'> <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 dangerouslySetInnerHTML={{__html:data&&data.content}} className="py-5"></div>
</div> </div>
</div> </div>
...@@ -81,7 +86,7 @@ export const NewsDetails = (props:NewsDetailsType)=>{ ...@@ -81,7 +86,7 @@ export const NewsDetails = (props:NewsDetailsType)=>{
<div> <div>
{ {
latestNews&&latestNews.map((k:any,index:number)=>( 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>{k.title}</div>
<div>{useDate(data&&data.time_stamp).year}/{useDate(data&&data.time_stamp).month}/{useDate(data&&data.time_stamp).day}</div> <div>{useDate(data&&data.time_stamp).year}/{useDate(data&&data.time_stamp).month}/{useDate(data&&data.time_stamp).day}</div>
</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