After improving the design for the web part8

This commit is contained in:
Your Name 2026-11-06 20:04:46 +02:00
parent a04465f265
commit 46a062fcb8

View File

@ -27,6 +27,7 @@ const defaultGradient =
export function PromoCarousel({ ads, loading }: Props) { export function PromoCarousel({ ads, loading }: Props) {
const [index, setIndex] = useState(0); const [index, setIndex] = useState(0);
const count = ads.length; const count = ads.length;
const showNav = count > 1;
useEffect(() => { useEffect(() => {
setIndex(0); setIndex(0);
@ -44,7 +45,7 @@ export function PromoCarousel({ ads, loading }: Props) {
return ( return (
<Skeleton <Skeleton
variant="rounded" variant="rounded"
sx={{ height: { xs: 220, sm: 280, md: 320 }, borderRadius: 2 }} sx={{ height: { xs: 160, sm: 180 }, borderRadius: 2 }}
/> />
); );
} }
@ -65,7 +66,6 @@ export function PromoCarousel({ ads, loading }: Props) {
position: 'relative', position: 'relative',
overflow: 'hidden', overflow: 'hidden',
borderRadius: 2, borderRadius: 2,
minHeight: { xs: 220, sm: 280, md: 320 },
border: `1px solid ${alpha(accent, 0.35)}`, border: `1px solid ${alpha(accent, 0.35)}`,
background: bg, background: bg,
backgroundSize: 'cover', backgroundSize: 'cover',
@ -93,22 +93,28 @@ export function PromoCarousel({ ads, loading }: Props) {
sx={{ sx={{
position: 'relative', position: 'relative',
zIndex: 1, zIndex: 1,
p: { xs: 2.5, sm: 3.5, md: 4 }, // Top-align like the public landing; pad past absolute arrows on sm+.
px: {
xs: 2.5,
sm: showNav ? 7 : 3.5,
md: showNav ? 7.5 : 4,
},
pt: { xs: 2.5, sm: 3, md: 3.25 },
pb: showNav ? { xs: 4.5, sm: 5 } : { xs: 2.5, sm: 3 },
display: 'flex', display: 'flex',
flexDirection: 'column', flexDirection: 'column',
justifyContent: 'flex-end', justifyContent: 'flex-start',
minHeight: { xs: 220, sm: 280, md: 320 },
background: background:
'linear-gradient(to top, rgba(11,14,20,0.92) 0%, rgba(11,14,20,0.35) 55%, transparent 100%)', 'linear-gradient(to top, rgba(11,14,20,0.88) 0%, rgba(11,14,20,0.45) 55%, rgba(11,14,20,0.2) 100%)',
}} }}
> >
<Stack spacing={1.5} sx={{ maxWidth: 560 }}> <Stack spacing={1.25} sx={{ maxWidth: 560 }}>
<Typography <Typography
variant="h4" variant="h4"
sx={{ sx={{
fontWeight: 900, fontWeight: 900,
letterSpacing: 0.2, letterSpacing: 0.2,
fontSize: { xs: '1.5rem', sm: '2rem', md: '2.125rem' }, fontSize: { xs: '1.5rem', sm: '1.85rem', md: '2rem' },
lineHeight: 1.15, lineHeight: 1.15,
}} }}
> >
@ -120,7 +126,7 @@ export function PromoCarousel({ ads, loading }: Props) {
</Typography> </Typography>
)} )}
{ad.ctaLabel && link && ( {ad.ctaLabel && link && (
<Box sx={{ pt: 0.5 }}> <Box sx={{ pt: 0.25 }}>
{isExternal ? ( {isExternal ? (
<Button <Button
href={ad.linkUrl!} href={ad.linkUrl!}
@ -158,14 +164,14 @@ export function PromoCarousel({ ads, loading }: Props) {
</Stack> </Stack>
</Box> </Box>
{count > 1 && ( {showNav && (
<> <>
<IconButton <IconButton
aria-label="Previous promotion" aria-label="Previous promotion"
onClick={() => setIndex((i) => (i - 1 + count) % count)} onClick={() => setIndex((i) => (i - 1 + count) % count)}
sx={{ sx={{
position: 'absolute', position: 'absolute',
left: 8, left: 10,
top: '50%', top: '50%',
transform: 'translateY(-50%)', transform: 'translateY(-50%)',
zIndex: 2, zIndex: 2,
@ -181,7 +187,7 @@ export function PromoCarousel({ ads, loading }: Props) {
onClick={() => setIndex((i) => (i + 1) % count)} onClick={() => setIndex((i) => (i + 1) % count)}
sx={{ sx={{
position: 'absolute', position: 'absolute',
right: 8, right: 10,
top: '50%', top: '50%',
transform: 'translateY(-50%)', transform: 'translateY(-50%)',
zIndex: 2, zIndex: 2,