Skip to content

Commit cb92db2

Browse files
feat: the mobile background is now static images instead of a video to improve performance
1 parent 880cc4c commit cb92db2

File tree

5 files changed

+51
-20
lines changed

5 files changed

+51
-20
lines changed

public/locales/en/common.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"h1": "Welcome to my portfolio",
3-
"h2": "I am <1>Fernand</1>, a dev lead in South Korea. Passionate about video-games, I currently work with Next.js, Node.js, Typescript & GraphQL.",
3+
"h2": "I am <1>Fernand</1>, a fullstack dev lead in South Korea. Passionate about video-games, I currently work with Next.js, Node.js, Typescript & GraphQL.",
44
"skills": "My skills",
55
"about": "about",
66
"contact": "contact",

public/locales/fr/common.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"h1": "Bienvenue dans mon portfolio",
3-
"h2": "Je suis <1>Fernand</1>, un dev lead en Corée du Sud. Passionné de jeux-vidéos, je travaille actuellement avec Next.js, Node.js, Typescript & GraphQL.",
3+
"h2": "Je suis <1>Fernand</1>, un dev lead fullstack en Corée du Sud. Passionné de jeux-vidéos, je travaille actuellement avec Next.js, Node.js, Typescript & GraphQL.",
44
"skills": "mes compétences",
55
"about": "à propos",
66
"contact": "contact",

public/locales/ko/common.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"h1": "제 포트폴리오에 오신 것을 환영합니다.",
3-
"h2": "저는 한국에 사는 개발 리드 <1>페르난도</1>입니다. 비디오 게임에 열광하는 저는 현재 Next.js, Node.js, Typescript & GraphQL을 사용해 작업하고있습니다.",
3+
"h2": "저는 한국에 사는 풀스택 개발 리드 <1>페르난도</1>입니다. 비디오 게임에 열광하는 저는 현재 Next.js, Node.js, Typescript & GraphQL을 사용해 작업하고있습니다.",
44
"skills": "스킬즈",
55
"about": "저는...",
66
"contact": "콘택트",

src/app/[lang]/page.tsx

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
import React from 'react'
2-
import { Box, Container, Grid, NoSsr, Paper, SxProps, Theme } from '@mui/material'
3-
import { BrowserView, MobileView } from 'react-device-detect'
4-
import CrossFadeImage from 'components/images/CrossFadeImage'
5-
import { getFragmentData, graphql } from 'generated'
6-
import { ProjectElementFragmentDoc } from 'generated/graphql'
2+
import { Box, Container, Grid, Paper, SxProps, Theme } from '@mui/material'
3+
import { graphql } from 'generated'
74
import apolloClient from 'apolloClient'
85
import styles from 'styles/Home.module.css'
96
import ContactForm from 'components/contact/ContactForm'
@@ -13,6 +10,7 @@ import SkillContainer from 'components/skills/SkillContainer'
1310
import ProjectContainer from 'components/project/ProjectContainer'
1411
import WelcomeMessage from 'components/home/WelcomeMessage'
1512
import DownArrow from 'components/home/DownArrow'
13+
import Background from 'components/home/Background'
1614

1715
interface HomePageProps {
1816
params: {
@@ -72,18 +70,7 @@ async function HomePage({ params }: HomePageProps) {
7270
return (
7371
<>
7472
<Box id={'home'} sx={style.root} />
75-
<NoSsr>
76-
<BrowserView>
77-
<Box component={'video'} autoPlay muted loop preload="none" id="backgroundVideo" sx={style.videoContainer}>
78-
<source src="/backgroundVideo.mp4" type="video/mp4" />
79-
</Box>
80-
</BrowserView>
81-
<MobileView>
82-
<Box sx={style.videoContainer}>
83-
<CrossFadeImage images={getFragmentData(ProjectElementFragmentDoc, projects).map((o) => o.image.url)} />
84-
</Box>
85-
</MobileView>
86-
</NoSsr>
73+
<Background projects={projects} />
8774
<Container className={styles.mainGrid}>
8875
<Grid container className={styles.mainGrid} alignItems={'center'}>
8976
<Grid item xs={12} sx={{ color: 'secondary.main', textShadow: '1px 1px 5px black' }}>

src/components/home/Background.tsx

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
'use client'
2+
3+
import React from 'react'
4+
import { Box, NoSsr, SxProps, Theme } from '@mui/material'
5+
import { BrowserView, MobileView } from 'react-device-detect'
6+
import CrossFadeImage from 'components/images/CrossFadeImage'
7+
import { FragmentType, getFragmentData } from 'generated'
8+
import { ProjectElementFragmentDoc } from 'generated/graphql'
9+
import { ProjectElement } from 'components/project/project.operations'
10+
11+
interface BackgroundProps {
12+
projects: FragmentType<typeof ProjectElement>[]
13+
}
14+
15+
const style: Record<'videoContainer', SxProps<Theme>> = {
16+
videoContainer: {
17+
height: { xs: 'calc(100vh - 56px)', md: 'calc(100vh - 64px)' },
18+
top: { sx: 56, md: 64 },
19+
width: '100%',
20+
position: 'fixed',
21+
zIndex: -3,
22+
objectFit: 'cover',
23+
filter: 'blur(4px)',
24+
msFilter: 'blur(4px)',
25+
webkitFilter: 'blur(4px)',
26+
},
27+
}
28+
29+
export default function Background({ projects }: BackgroundProps) {
30+
return (
31+
<NoSsr>
32+
<BrowserView>
33+
<Box component={'video'} autoPlay muted loop preload="none" id="backgroundVideo" sx={style.videoContainer}>
34+
<source src="/backgroundVideo.mp4" type="video/mp4" />
35+
</Box>
36+
</BrowserView>
37+
<MobileView>
38+
<Box sx={style.videoContainer}>
39+
<CrossFadeImage images={getFragmentData(ProjectElementFragmentDoc, projects).map((o) => o.image.url)} />
40+
</Box>
41+
</MobileView>
42+
</NoSsr>
43+
)
44+
}

0 commit comments

Comments
 (0)