All files / src/pages HomePage.tsx

100% Statements 4/4
100% Branches 0/0
100% Functions 2/2
100% Lines 4/4

Press n or j to go to the next uncovered block, b, p or k for the previous block.

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 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159                                    1x               5x   5x                                                                                                                                                                                           20x                                                                        
import Box from '@mui/material/Box';
import Stack from '@mui/material/Stack';
import Typography from '@mui/material/Typography';
import Button from '@mui/material/Button';
import { useTranslation } from 'react-i18next';
import Seo from '../components/Seo';
 
import heroImg from '../assets/home/jo-hero.jpg';
import openingImg from '../assets/home/opening.jpg';
import athleticsImg from '../assets/home/athletics.webp';
import swimmingImg from '../assets/home/swimming.webp';
import judoImg from '../assets/home/judo.jpg';
 
interface Event {
  id: number;
  imageUrl: string;
}
 
const events: Event[] = [
  { id: 1, imageUrl: openingImg },
  { id: 2, imageUrl: athleticsImg },
  { id: 3, imageUrl: swimmingImg },
  { id: 4, imageUrl: judoImg }, 
];
 
export default function TicketsPage() {
  const { t } = useTranslation('home');
 
  return (
    <>
      {/* SEO */}
      <Seo />
 
      {/* Hero */}
      <Box
        component="section"
        sx={{
          position: 'relative',
          height: 400,
          mb: 6,
          background: `url(${heroImg}) center/cover no-repeat`,
          display: 'flex',
          alignItems: 'center',
          justifyContent: 'center',
        }}
      >
        {/* Overlay semi-transparent */}
        <Box
          sx={{
            position: 'absolute',
            inset: 0,
            bgcolor: 'rgba(0,0,0,0.6)',
          }}
        />
 
        {/* Contenu centré */}
        <Box sx={{ position: 'relative', textAlign: 'center', px: 2 }}>
          <Typography
            variant="h2"
            sx={{
              position: 'relative',
              color: 'common.white',
              p: 2,
              borderRadius: 1,
              textAlign: 'center',
              textTransform: 'uppercase',
            }}
          >
            {t('hero.title')}
          </Typography>
          <Typography
            variant="subtitle1"
            sx={{
              color: 'common.white',
              mt: 1,
              fontStyle: 'italic',
              opacity: 0.85,
            }}
          >
            {t('hero.subtitle')}
          </Typography>
        </Box>
      </Box>
 
      {/* Historique */}
      <Box
        component="section"
        sx={{ maxWidth: 800, mx: 'auto', mb: 8, px: 2 }}
      >
        <Typography variant="h3" gutterBottom>
          {t('history.title')}
        </Typography>
        <Typography variant="body1">
          {t('history.text')}
        </Typography>
      </Box>
 
      {/* CTA */}
      <Box textAlign="center" mb={6}>
        <Button variant="contained" size="large" href="/tickets">
          {t('cta.title')}
        </Button>
      </Box>
 
      {/* Événements */}
      <Box component="section" sx={{ maxWidth: 800, mx: 'auto', mb: 4, px: 2 }}>
        <Typography variant="h3" gutterBottom>
          {t('events.title')}
        </Typography>
        <Typography variant="body1" color="text.secondary" mb={4}>
          {t('events.intro')}
        </Typography>
 
        <Box
          sx={{
            display: 'flex',
            flexWrap: 'wrap',
            gap: 4,
            justifyContent: 'center',
          }}
        >
          {events.map((evt) => (
            <Box
              key={evt.id}
              sx={{
                flex: '1 1 calc(33.333% - 32px)',
                minWidth: 260,
                maxWidth: 320,
                border: 1,
                borderColor: 'divider',
                borderRadius: 2,
                overflow: 'hidden',
                boxShadow: 3,
                display: 'flex',
                flexDirection: 'column',
              }}
            >
              <Box
                component="img"
                src={evt.imageUrl}
                alt={t(`events.item${evt.id}.title`)}
                loading="lazy"
                sx={{ width: '100%', height: 180, objectFit: 'cover' }}
              />
              <Stack spacing={1} sx={{ p: 2, flexGrow: 1 }}>
                <Typography variant="h6">
                  {t(`events.item${evt.id}.title`)}
                </Typography>
                <Typography variant="body2" color="text.secondary">
                  {t(`events.item${evt.id}.description`)}
                </Typography>
              </Stack>
            </Box>
          ))}
        </Box>
      </Box>
    </>
  );
}