|
1 | 1 | import { FC } from 'react'; |
2 | | -import { Box, Typography, Button, Stack, Skeleton } from '@mui/material'; |
3 | | -import { heroStyles } from '../../styles/Hero.styles'; |
4 | 2 | import { useTranslation } from 'react-i18next'; |
5 | 3 | import NextLink from 'next/link'; |
6 | | -import { motion } from 'framer-motion'; |
| 4 | +import { |
| 5 | +Container, |
| 6 | +Title, |
| 7 | +Subtitle, |
| 8 | +HeroStack, |
| 9 | +HeroButton, |
| 10 | +HeroSkeleton |
| 11 | +} from '../../styles/Hero.styles'; |
7 | 12 |
|
8 | 13 | const Hero: FC = () => { |
9 | | - const { t, ready } = useTranslation(); |
10 | | - if (!ready) { |
11 | | - return ( |
12 | | - <Box |
13 | | - component={motion.div} |
14 | | - initial={{ opacity: 0, y: -50 }} |
15 | | - animate={{ opacity: 1, y: 0 }} |
16 | | - transition={{ duration: 1 }} |
17 | | - sx={heroStyles.container} |
18 | | - > |
19 | | - <Skeleton variant="text" width="60%" height={64} /> |
20 | | - <Skeleton variant="text" width="40%" height={40} /> |
21 | | - <Stack direction="row" spacing={2} sx={{ mt: 3, zIndex: 2 }}> |
22 | | - <Skeleton variant="rectangular" width={120} height={48} /> |
23 | | - <Skeleton variant="rectangular" width={120} height={48} /> |
24 | | - </Stack> |
25 | | - </Box> |
26 | | - ); |
27 | | - } |
| 14 | +const { t, ready } = useTranslation(); |
28 | 15 |
|
| 16 | +const animProps = { |
| 17 | + initial: { opacity: 0, y: -50 }, |
| 18 | + animate: { opacity: 1, y: 0 }, |
| 19 | + transition: { duration: 1 } |
| 20 | +}; |
| 21 | + |
| 22 | +if (!ready) { |
29 | 23 | return ( |
30 | | - <Box |
31 | | - component={motion.div} |
32 | | - initial={{ opacity: 0, y: -50 }} |
33 | | - animate={{ opacity: 1, y: 0 }} |
34 | | - transition={{ duration: 1 }} |
35 | | - sx={heroStyles.container} |
36 | | - > |
37 | | - <Typography variant="h2" sx={heroStyles.title}> |
38 | | - {t('hero.title', 'Welcome to My Portfolio')} |
39 | | - </Typography> |
40 | | - <Typography variant="h5" sx={heroStyles.subtitle}> |
41 | | - {t('hero.subtitle', 'Tayfur Furkan Hayat a.k.a. Espe, EspeeeBne, Sora, Rika')} |
42 | | - </Typography> |
43 | | - <Stack direction="row" spacing={2} sx={{ mt: 3, zIndex: 2 }}> |
44 | | - <NextLink href="/about" passHref legacyBehavior> |
45 | | - <Button variant="contained" color="primary" sx={{ textTransform: 'none' }}> |
46 | | - {t('hero.about', 'Hakkımda')} |
47 | | - </Button> |
48 | | - </NextLink> |
49 | | - <NextLink href="/projects" passHref legacyBehavior> |
50 | | - <Button variant="contained" color="primary" sx={{ textTransform: 'none' }}> |
51 | | - {t('hero.projects', 'Projelerim')} |
52 | | - </Button> |
53 | | - </NextLink> |
54 | | - </Stack> |
55 | | - </Box> |
| 24 | + <Container {...animProps}> |
| 25 | + <HeroSkeleton.line variant="text" width="60%" height={64} /> |
| 26 | + <HeroSkeleton.line variant="text" width="40%" height={40} /> |
| 27 | + <HeroStack> |
| 28 | + <HeroSkeleton.rect variant="rectangular" width={120} height={48} /> |
| 29 | + <HeroSkeleton.rect variant="rectangular" width={120} height={48} /> |
| 30 | + </HeroStack> |
| 31 | + </Container> |
56 | 32 | ); |
| 33 | +} |
| 34 | + |
| 35 | +return ( |
| 36 | + <Container {...animProps}> |
| 37 | + <Title variant="h2"> |
| 38 | + {t('hero.title', 'Welcome to My Portfolio')} |
| 39 | + </Title> |
| 40 | + <Subtitle variant="h5"> |
| 41 | + {t( |
| 42 | + 'hero.subtitle', |
| 43 | + 'Tayfur Furkan Hayat a.k.a. Espe, EspeeeBne, Sora, Rika' |
| 44 | + )} |
| 45 | + </Subtitle> |
| 46 | + |
| 47 | + <HeroStack> |
| 48 | + <NextLink href="/about" passHref legacyBehavior> |
| 49 | + <HeroButton variant="outlined"> |
| 50 | + {t('hero.about', 'Hakkımda')} |
| 51 | + </HeroButton> |
| 52 | + </NextLink> |
| 53 | + <NextLink href="/projects" passHref legacyBehavior> |
| 54 | + <HeroButton variant="outlined"> |
| 55 | + {t('hero.projects', 'Projelerim')} |
| 56 | + </HeroButton> |
| 57 | + </NextLink> |
| 58 | + </HeroStack> |
| 59 | + </Container> |
| 60 | +); |
57 | 61 | }; |
58 | 62 |
|
59 | 63 | export default Hero; |
0 commit comments