/
Hero.jsx
114 lines (105 loc) · 2.88 KB
/
Hero.jsx
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
import { useSelector } from "react-redux";
import { selectData } from "../pages/homeSlice";
import { Link } from "react-scroll";
import styled from "styled-components";
// Icons
import { Icon } from "@iconify/react";
// Media
import Logo from "../images/logo.svg";
import { Light, Dark } from "../data";
// Components
import { Col, Container, Row } from "react-bootstrap";
import { Spin } from "./globalStyledComponents";
import SocialLinks from "./SocialLinks";
const StyledHero = styled.header`
position: relative;
display: grid;
place-items: center;
max-width: 1920px;
margin: 0 auto;
min-height: calc(100vh - var(--nav-height));
&::before {
content: "";
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: ${({ theme }) =>
theme.name === "light"
? "linear-gradient(135deg, var(--primary), var(--bs-light))"
: "linear-gradient(135deg, var(--primary), var(--bs-dark))"};
z-index: -2;
}
/* Overlay for contrast */
&::after {
content: "";
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: ${({ theme }) =>
theme.name === "light"
? "rgba(255, 255, 255, 0.2)"
: "rgba(0, 0, 0, 0.2)"};
z-index: -1;
}
.down-container {
height: 10rem;
}
@media (prefers-reduced-motion: no-preference) {
.hero-img {
animation: ${Spin} infinite 20s linear;
}
}
@media screen and (min-width: 1180px) {
&::before {
background: ${({ theme }) =>
theme.name === "light"
? `url(${Light}) top center fixed no-repeat`
: `url(${Dark}) top center fixed no-repeat`};
background-size: 100vw auto;
}
}
@media screen and (min-width: 1367px) {
&::before {
background: ${({ theme }) =>
theme.name === "light"
? `url(${Light}) center center fixed no-repeat`
: `url(${Dark}) center center fixed no-repeat`};
background-size: cover;
}
}
`;
export default function Hero() {
const { name } = useSelector(selectData);
return (
<StyledHero>
<Container>
<Row className="align-items-center text-center">
<Col>
<h1 className="mb-3 display-3 title">{name}</h1>
<div className="d-flex align-items-center justify-content-center">
<SocialLinks />
</div>
</Col>
<Col className="d-none d-md-block">
<img
src={Logo}
alt="React Logo"
className="w-75 mx-auto hero-img"
/>
</Col>
</Row>
<Row className="align-items-end down-container">
<Col className="m-4 text-center">
<Link to={"About"} className="link-icons">
<Icon icon="fa6-solid:circle-chevron-down" />
</Link>
</Col>
</Row>
</Container>
</StyledHero>
);
}