After improving the design for the web part8
This commit is contained in:
parent
a04465f265
commit
46a062fcb8
@ -27,6 +27,7 @@ const defaultGradient =
|
||||
export function PromoCarousel({ ads, loading }: Props) {
|
||||
const [index, setIndex] = useState(0);
|
||||
const count = ads.length;
|
||||
const showNav = count > 1;
|
||||
|
||||
useEffect(() => {
|
||||
setIndex(0);
|
||||
@ -44,7 +45,7 @@ export function PromoCarousel({ ads, loading }: Props) {
|
||||
return (
|
||||
<Skeleton
|
||||
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',
|
||||
overflow: 'hidden',
|
||||
borderRadius: 2,
|
||||
minHeight: { xs: 220, sm: 280, md: 320 },
|
||||
border: `1px solid ${alpha(accent, 0.35)}`,
|
||||
background: bg,
|
||||
backgroundSize: 'cover',
|
||||
@ -93,22 +93,28 @@ export function PromoCarousel({ ads, loading }: Props) {
|
||||
sx={{
|
||||
position: 'relative',
|
||||
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',
|
||||
flexDirection: 'column',
|
||||
justifyContent: 'flex-end',
|
||||
minHeight: { xs: 220, sm: 280, md: 320 },
|
||||
justifyContent: 'flex-start',
|
||||
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
|
||||
variant="h4"
|
||||
sx={{
|
||||
fontWeight: 900,
|
||||
letterSpacing: 0.2,
|
||||
fontSize: { xs: '1.5rem', sm: '2rem', md: '2.125rem' },
|
||||
fontSize: { xs: '1.5rem', sm: '1.85rem', md: '2rem' },
|
||||
lineHeight: 1.15,
|
||||
}}
|
||||
>
|
||||
@ -120,7 +126,7 @@ export function PromoCarousel({ ads, loading }: Props) {
|
||||
</Typography>
|
||||
)}
|
||||
{ad.ctaLabel && link && (
|
||||
<Box sx={{ pt: 0.5 }}>
|
||||
<Box sx={{ pt: 0.25 }}>
|
||||
{isExternal ? (
|
||||
<Button
|
||||
href={ad.linkUrl!}
|
||||
@ -158,14 +164,14 @@ export function PromoCarousel({ ads, loading }: Props) {
|
||||
</Stack>
|
||||
</Box>
|
||||
|
||||
{count > 1 && (
|
||||
{showNav && (
|
||||
<>
|
||||
<IconButton
|
||||
aria-label="Previous promotion"
|
||||
onClick={() => setIndex((i) => (i - 1 + count) % count)}
|
||||
sx={{
|
||||
position: 'absolute',
|
||||
left: 8,
|
||||
left: 10,
|
||||
top: '50%',
|
||||
transform: 'translateY(-50%)',
|
||||
zIndex: 2,
|
||||
@ -181,7 +187,7 @@ export function PromoCarousel({ ads, loading }: Props) {
|
||||
onClick={() => setIndex((i) => (i + 1) % count)}
|
||||
sx={{
|
||||
position: 'absolute',
|
||||
right: 8,
|
||||
right: 10,
|
||||
top: '50%',
|
||||
transform: 'translateY(-50%)',
|
||||
zIndex: 2,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user