Skip to content

Commit e93983a

Browse files
committed
improve image loading on landing page
1 parent 8ad8070 commit e93983a

File tree

7 files changed

+50
-34
lines changed

7 files changed

+50
-34
lines changed
1.18 MB
Loading

public/assets/images/landing-page/flying-kid.svg

-14
This file was deleted.
1.08 MB
Loading

public/assets/images/landing-page/star_woman.svg

-14
This file was deleted.

src/index.css

+10
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,13 @@ code {
1111
font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
1212
monospace;
1313
}
14+
15+
/* 👇 Add this at the bottom */
16+
@keyframes pulse {
17+
0% {
18+
background-position: 100% 50%;
19+
}
20+
100% {
21+
background-position: 0 50%;
22+
}
23+
}

src/ui/screens/landing-page/sections/mission/views/LandingPageMissionDesktop.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import RegularButton from "@/ui/shared-components/RegularButton";
77

88
const LandingPageMissionDesktop = ({ isDesktop }) => {
99
const { t } = useTranslation();
10-
const starWoman = `${process.env.PUBLIC_URL}/assets/images/landing-page/flying-kid.svg`;
10+
const starWoman = `${process.env.PUBLIC_URL}/assets/images/landing-page/flying-kid.png`;
1111

1212
return (
1313
<VBox sx={{

src/ui/screens/landing-page/sections/top-section/LandingPageTopSection.js

+39-5
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ import LandingPageTopSectionShared from "./components/LandingPageTopSectionShare
88
const LandingPageTopSection = () => {
99
const isDesktop = useStore((state) => state.isDesktop);
1010
const [loaded, setLoaded] = useState(false);
11-
const starWoman = `${process.env.PUBLIC_URL}/assets/images/landing-page/star_woman.svg`;
11+
const starWoman = `${process.env.PUBLIC_URL}/assets/images/landing-page/star_woman.png`;
12+
const imageSize = isDesktop ? 523 : 328;
1213

1314
return (
1415
<LandingPageSectionWrapper>
@@ -20,23 +21,56 @@ const LandingPageTopSection = () => {
2021
<RegularButton variant={'yellowContained'} link='/user-routing' />
2122
</VBox>
2223
</VBox>
23-
<VBox sx={{ width: "50%", alignItems: "center" }}>
24+
<VBox sx={{ width: "50%", alignItems: "center", position: "relative" }}>
25+
{!loaded && (
26+
<div
27+
style={{
28+
width: `${imageSize}px`,
29+
height: `${imageSize}px`
30+
}}
31+
/>
32+
)}
2433
<img
2534
src={starWoman}
2635
alt="logo"
2736
style={{
28-
width: "523px",
29-
height: "523px",
37+
width: `${imageSize}px`,
38+
height: `${imageSize}px`,
39+
position: loaded ? "static" : "absolute",
3040
opacity: loaded ? 1 : 0,
3141
transition: "opacity 0.8s ease-in-out",
42+
borderRadius: "12px",
3243
}}
3344
onLoad={() => setLoaded(true)}
3445
/>
3546
</VBox>
3647
</HBox>
3748
) : (
3849
<VBox sx={{ gap: "46px", alignItems: "center" }}>
39-
<img src={starWoman} alt="logo" style={{ width: "328px" }} />
50+
<VBox sx={{ alignItems: "center", position: "relative" }}>
51+
{!loaded && (
52+
<div
53+
style={{
54+
width: `${imageSize}px`,
55+
height: `${imageSize}px`,
56+
}}
57+
/>
58+
)}
59+
<img
60+
src={starWoman}
61+
alt="logo"
62+
style={{
63+
width: `${imageSize}px`,
64+
height: `${imageSize}px`,
65+
position: loaded ? "static" : "absolute",
66+
opacity: loaded ? 1 : 0,
67+
transition: "opacity 0.8s ease-in-out",
68+
borderRadius: "12px",
69+
}}
70+
onLoad={() => setLoaded(true)}
71+
/>
72+
</VBox>
73+
4074
<VBox sx={{ gap: "16px" }}>
4175
<LandingPageTopSectionShared />
4276
<RegularButton variant={'yellowContained'} link='/user-routing' />

0 commit comments

Comments
 (0)