-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathHome.tsx
More file actions
61 lines (56 loc) · 1.65 KB
/
Copy pathHome.tsx
File metadata and controls
61 lines (56 loc) · 1.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
import React, {useEffect, useRef} from "react";
import {
PageContainer,
SectionContainer,
ImageSection,
StyledLandingPageSky,
StyledStoreFront,
SearchSection
} from './Home.styles';
import {RouteComponentProps} from "react-router-dom";
import Storefront from "../../assets/Storefront.png";
import HowItWorks from "./HowItWorks";
import AboutUs from "./AboutUs";
import ThankYou from "./ThankYou";
import {LocationState} from "../../types";
import {SearchForm} from "./SearchForm";
import Typography from "@material-ui/core/Typography";
const Home: React.FC<RouteComponentProps<{}, {}, LocationState>> = ({
location,
}) => {
const aboutRef = useRef<HTMLDivElement>(null);
useEffect(() => {
if (location.state && location.state.toAbout && aboutRef.current) {
aboutRef.current.scrollIntoView({
behavior: "smooth",
});
}
if (location.state && location.state.toHome) {
window.scrollTo(0, 0);
}
}, [location]);
return (
<PageContainer>
<SectionContainer>
<ImageSection>
<StyledLandingPageSky title="Landing page sky" />
<StyledStoreFront src={Storefront} alt="Storefront" />
</ImageSection>
<SearchSection>
<Typography variant="h3">Find Loans & Grants</Typography>
<SearchForm />
</SearchSection>
</SectionContainer>
<SectionContainer>
<HowItWorks />
</SectionContainer>
<SectionContainer ref={aboutRef} style={{scrollMarginTop: "-98px"}}>
<AboutUs />
</SectionContainer>
<SectionContainer>
<ThankYou />
</SectionContainer>
</PageContainer>
);
};
export default Home;