کار کردم که اگر کاربر وسط یک صفحه ای بود و روی یکی از ایتم های موجود در هدر زد و وارد اون صفحه جدیده زد صفحه جدید از بالا باز شود | 35

temp
mahdi 2 years ago
parent 4d2b89dca3
commit 477282518b
  1. 6
      src/views/About/index.js
  2. 2
      src/views/Blog/index.js
  3. 7
      src/views/Blogs/index.js
  4. 4
      src/views/Contact/index.js
  5. 19
      src/views/Home/index.js

@ -21,9 +21,13 @@ function About({
setHeaderOptions({ shown: true }); setHeaderOptions({ shown: true });
}, []); }, []);
useEffect(() => {
window.scrollTo(0, 0);
}, []);
return ( return (
<div className={_.join(["about w-11/12 mx-auto flex flex-col"], " ")}> <div className={_.join(["about w-11/12 mx-auto flex flex-col"], " ")}>
<main className="flex flex-col items-center pt-16"> <main className="flex flex-col items-center pt-16 ">
<header> <header>
<h1>{first.title}</h1> <h1>{first.title}</h1>
<p <p

@ -35,7 +35,7 @@ export const Blog = ({
getInfo({ id: location.getId() }); getInfo({ id: location.getId() });
}, [activeBlog]); }, [activeBlog]);
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 />
{isMobile && ( {isMobile && (
<div <div

@ -27,8 +27,13 @@ export const Blogs = ({ isMobile, getList, blogs, setHeaderOptions }) => {
} }
getList(); getList();
}, []); }, []);
useEffect(() => {
window.scrollTo(0, 0);
}, []);
return ( return (
<div className="flex w-full px-4 lg:px-0 flex-col lg:w-11/12 mx-auto lg:py-24 pb-24 lg:pb-0"> <div className="flex w-full px-4 lg:px-0 flex-col lg:w-11/12 mx-auto lg:py-24 pb-24 lg:pb-0 ">
<Hashtags /> <Hashtags />
<Single /> <Single />
<Header title={window.t(" تازهترینها از وبلاگ")} /> <Header title={window.t(" تازهترینها از وبلاگ")} />

@ -21,6 +21,10 @@ function Contact({ headerOptions, setHeaderOptions, info, isMobile, isDark }) {
setHeaderOptions(headerOptions); setHeaderOptions(headerOptions);
}, []); }, []);
useEffect(() => {
window.scrollTo(0, 0);
}, []);
return ( return (
<div <div
className="w-full flex h-auto flex-col bg-transparent lg:pt-36 lg:pb-24" className="w-full flex h-auto flex-col bg-transparent lg:pt-36 lg:pb-24"

@ -1,7 +1,7 @@
import React, { useEffect } from "react"; import React, { useEffect } from "react";
import { connect } from "react-redux"; import { connect } from "react-redux";
import DesktopHome from './Desktop'; import DesktopHome from "./Desktop";
import Portrait from "./Portrait"; import Portrait from "./Portrait";
import { publicApi } from "../../redux/actions"; import { publicApi } from "../../redux/actions";
@ -9,12 +9,20 @@ function Home({ setHeaderOptions, headerOptions, isMobile }) {
useEffect(() => { useEffect(() => {
setHeaderOptions(headerOptions); setHeaderOptions(headerOptions);
}, []); }, []);
useEffect(() => {
window.scrollTo(0, 0);
}, []);
return ( return (
<> <>
{isMobile ? (
{ <Portrait />
isMobile ? <Portrait /> : <div className="flex justify-center"><DesktopHome /></div> ) : (
} <div className="flex justify-center ">
<DesktopHome />
</div>
)}
{/* <Landscape /> */} {/* <Landscape /> */}
</> </>
@ -27,7 +35,6 @@ const mapStateToProps = (state) => ({
const mapDispatchToProps = { const mapDispatchToProps = {
setHeaderOptions: publicApi.setHeaderOptions, setHeaderOptions: publicApi.setHeaderOptions,
}; };
export default connect(mapStateToProps, mapDispatchToProps)(Home); export default connect(mapStateToProps, mapDispatchToProps)(Home);

Loading…
Cancel
Save