@ -9,6 +9,7 @@ import Header from "../Blogs/layouts/Header";
import Suggest from "../Blogs/layouts/Suggest" ;
import Suggest from "../Blogs/layouts/Suggest" ;
import New from "../Blogs/layouts/New" ;
import New from "../Blogs/layouts/New" ;
import Avatar from "../../components/Avatar" ;
import Avatar from "../../components/Avatar" ;
import { useParams } from "react-router-dom" ;
//assets
//assets
import arrow from "../../assets/icons/dropdown-blue.svg" ;
import arrow from "../../assets/icons/dropdown-blue.svg" ;
@ -23,17 +24,26 @@ export const Blog = ({
blogs ,
blogs ,
activeBlog ,
activeBlog ,
} ) => {
} ) => {
let { id } = useParams ( ) ;
console . log ( id ) ;
// let id = location.getId();
useEffect ( ( ) => {
useEffect ( ( ) => {
setHeaderOptions ( headerOptions ) ;
setHeaderOptions ( headerOptions ) ;
getInfo ( { id : location . getId ( ) } ) ;
getInfo ( { id : location . getId ( ) } ) ;
if ( blogs . length === 0 ) {
if ( blogs . length === 0 ) {
getList ( ) ;
getList ( ) ;
}
}
} , [ ] ) ;
} , [ id ] ) ;
useEffect ( ( ) => {
useEffect ( ( ) => {
getInfo ( { id : location . getId ( ) } ) ;
getInfo ( { id : location . getId ( ) } ) ;
} , [ activeBlog ] ) ;
} , [ activeBlog ] ) ;
useEffect ( ( ) => {
window . scrollTo ( 0 , 0 ) ;
} , [ ] ) ;
return (
return (
< div className = "flex flex-col lg:w-11/12 mx-auto lg:py-24 lg:px-0 px-4 lg:pb-0 pb-24" >
< div className = "flex flex-col lg:w-11/12 mx-auto lg:py-24 lg:px-0 px-4 lg:pb-0 pb-24" >
< Hashtags / >
< Hashtags / >
@ -120,6 +130,7 @@ export const Blog = ({
dangerouslySetInnerHTML = { { _ _html : blog ? . text } }
dangerouslySetInnerHTML = { { _ _html : blog ? . text } }
/ >
/ >
< Header title = { window . t ( "پیشنهادی" ) } / >
< Header title = { window . t ( "پیشنهادی" ) } / >
{ isMobile ? (
{ isMobile ? (
< div className = "w-full flex overflow-x-scroll no-scrollbar gap-4" >
< div className = "w-full flex overflow-x-scroll no-scrollbar gap-4" >
{ blogs . map ( ( blog , index ) => (
{ blogs . map ( ( blog , index ) => (
@ -152,7 +163,9 @@ export const Blog = ({
/ >
/ >
}
}
>
>
{ blogs . map ( ( blog , index ) => (
{ blogs
. filter ( ( e ) => e . id != blog . id )
. map ( ( blog , index ) => (
< Suggest blog = { blog } key = { index } / >
< Suggest blog = { blog } key = { index } / >
) ) }
) ) }
< / C a r o u s e l >
< / C a r o u s e l >