Skip to content

Commit de38ef5

Browse files
committed
refactor: Separate HomeWTC background image from gradient overlay using a pseudo-element and adjust content z-index.
1 parent 79d694d commit de38ef5

1 file changed

Lines changed: 23 additions & 21 deletions

File tree

src/views/Home/components/HomeWTC/Style.Home.tsx

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -21,45 +21,47 @@ interface StyledSubtitleProps {
2121
}
2222

2323
export const StyledHomeImage = styled.div`
24+
position: relative;
2425
padding: 70px 0 40px;
25-
background-image:
26-
linear-gradient(
26+
background-image: url(${images[Math.floor(Math.random() * images.length)]});
27+
background-size: cover;
28+
background-position: center;
29+
background-repeat: no-repeat;
30+
31+
&::before {
32+
content: "";
33+
position: absolute;
34+
top: 0;
35+
left: 0;
36+
right: 0;
37+
bottom: 0;
38+
background-image: linear-gradient(
2739
-45deg,
2840
${Color.LIGHT_BLUE}70,
2941
${Color.MAGENTA}70,
3042
${Color.DARK_BLUE}70,
3143
${Color.GREEN}70
32-
),
33-
url(${images[Math.floor(Math.random() * images.length)]});
34-
background-size:
35-
400% 400%,
36-
cover;
37-
background-position:
38-
0 50%,
39-
center;
40-
background-repeat: no-repeat;
41-
animation: gradient 15s ease infinite;
44+
);
45+
background-size: 400% 400%;
46+
background-position: 0 50%;
47+
animation: gradient 15s ease infinite;
48+
}
4249
4350
@keyframes gradient {
4451
0% {
45-
background-position:
46-
0 50%,
47-
center;
52+
background-position: 0 50%;
4853
}
4954
50% {
50-
background-position:
51-
100% 50%,
52-
center;
55+
background-position: 100% 50%;
5356
}
5457
100% {
55-
background-position:
56-
0 50%,
57-
center;
58+
background-position: 0 50%;
5859
}
5960
}
6061
`;
6162
export const StyleHomeContainer = styled.div`
6263
position: relative;
64+
z-index: 1;
6365
width: 100%;
6466
height: 100%;
6567
display: flex;

0 commit comments

Comments
 (0)