add sponsor carousel
This commit is contained in:
parent
b5cfdfbd47
commit
000d89bf9e
2 changed files with 103 additions and 16 deletions
|
|
@ -417,8 +417,9 @@ describe('homepage sponsor strip', () => {
|
|||
cy.get('[data-cy="sponsor-logo"]').should('have.length', 7)
|
||||
expectedAlts.forEach((altText) => {
|
||||
cy.get(`[data-cy="sponsor-logo"][alt="${altText}"]`)
|
||||
.should('be.visible')
|
||||
.should('have.attr', 'src')
|
||||
})
|
||||
cy.get('[data-cy="sponsor-carousel"]').should('be.visible')
|
||||
cy.get('[data-cy="sponsor-logo-duplicate"]')
|
||||
.should('have.length', 7)
|
||||
cy.get('[data-cy="sponsor-logo-duplicate"][alt=""]')
|
||||
|
|
|
|||
|
|
@ -173,6 +173,32 @@ const sponsors: Sponsor[] = [
|
|||
{ name: 'Yeshivat Lev HaTorah', src: '/assets/levhatorah.png' },
|
||||
]
|
||||
|
||||
const sponsorGroups: Sponsor[][] = [sponsors, sponsors]
|
||||
|
||||
function sponsorGroupDataCy(sponsorGroupIndex: number): string {
|
||||
if (sponsorGroupIndex === 0) {
|
||||
return 'sponsor-logo-group'
|
||||
}
|
||||
|
||||
return 'sponsor-logo-group-duplicate'
|
||||
}
|
||||
|
||||
function sponsorLogoAlt(sponsor: Sponsor, sponsorGroupIndex: number): string {
|
||||
if (sponsorGroupIndex === 0) {
|
||||
return sponsor.name
|
||||
}
|
||||
|
||||
return ''
|
||||
}
|
||||
|
||||
function sponsorLogoDataCy(sponsorGroupIndex: number): string {
|
||||
if (sponsorGroupIndex === 0) {
|
||||
return 'sponsor-logo'
|
||||
}
|
||||
|
||||
return 'sponsor-logo-duplicate'
|
||||
}
|
||||
|
||||
interface Project {
|
||||
title: string
|
||||
description: string
|
||||
|
|
@ -363,17 +389,27 @@ const projects: Project[] = [
|
|||
<section class="sponsors" data-cy="sponsors">
|
||||
<div class="sponsors__inner">
|
||||
<h2 class="sponsors__heading">Organizations Rabbi Gerzi has Worked With</h2>
|
||||
<div class="sponsors__row">
|
||||
<div class="sponsors__carousel" data-cy="sponsor-carousel">
|
||||
<div class="sponsors__track" data-cy="sponsor-track">
|
||||
<div
|
||||
v-for="(sponsorGroup, sponsorGroupIndex) in sponsorGroups"
|
||||
:key="`sponsor-group-${sponsorGroupIndex}`"
|
||||
class="sponsors__group"
|
||||
:aria-hidden="sponsorGroupIndex === 1 ? 'true' : undefined"
|
||||
:data-cy="sponsorGroupDataCy(sponsorGroupIndex)"
|
||||
>
|
||||
<img
|
||||
v-for="sponsor in sponsors"
|
||||
:key="sponsor.name"
|
||||
v-for="sponsor in sponsorGroup"
|
||||
:key="`${sponsorGroupIndex}-${sponsor.name}`"
|
||||
:src="sponsor.src"
|
||||
:alt="sponsor.name"
|
||||
:alt="sponsorLogoAlt(sponsor, sponsorGroupIndex)"
|
||||
class="sponsors__logo"
|
||||
data-cy="sponsor-logo"
|
||||
:data-cy="sponsorLogoDataCy(sponsorGroupIndex)"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="projects" data-cy="projects">
|
||||
|
|
@ -883,21 +919,62 @@ const projects: Project[] = [
|
|||
margin: 0 0 3rem 0;
|
||||
}
|
||||
|
||||
.sponsors__row {
|
||||
.sponsors__carousel {
|
||||
--sponsors-edge-fade: 50px;
|
||||
--sponsors-logo-gap: clamp(2.75rem, 4vw, 4.25rem);
|
||||
|
||||
width: 60%;
|
||||
margin: 0 auto;
|
||||
overflow: hidden;
|
||||
mask-image: linear-gradient(
|
||||
to right,
|
||||
transparent,
|
||||
black var(--sponsors-edge-fade),
|
||||
black calc(100% - var(--sponsors-edge-fade)),
|
||||
transparent
|
||||
);
|
||||
-webkit-mask-image: linear-gradient(
|
||||
to right,
|
||||
transparent,
|
||||
black var(--sponsors-edge-fade),
|
||||
black calc(100% - var(--sponsors-edge-fade)),
|
||||
transparent
|
||||
);
|
||||
}
|
||||
|
||||
.sponsors__track {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
width: max-content;
|
||||
animation: sponsors-scroll 28s linear infinite;
|
||||
will-change: transform;
|
||||
}
|
||||
|
||||
.sponsors__group {
|
||||
display: flex;
|
||||
flex: 0 0 auto;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 2.5rem 3rem;
|
||||
gap: var(--sponsors-logo-gap);
|
||||
padding-right: var(--sponsors-logo-gap);
|
||||
}
|
||||
|
||||
.sponsors__logo {
|
||||
height: 60px;
|
||||
height: clamp(78px, 7vw, 96px);
|
||||
width: auto;
|
||||
max-width: 160px;
|
||||
max-width: 220px;
|
||||
flex: 0 0 auto;
|
||||
object-fit: contain;
|
||||
}
|
||||
|
||||
@keyframes sponsors-scroll {
|
||||
from {
|
||||
transform: translateX(0);
|
||||
}
|
||||
|
||||
to {
|
||||
transform: translateX(-50%);
|
||||
}
|
||||
}
|
||||
|
||||
.projects {
|
||||
background: var(--color-cream);
|
||||
padding: 5rem 2rem;
|
||||
|
|
@ -1228,6 +1305,15 @@ const projects: Project[] = [
|
|||
transform: none;
|
||||
}
|
||||
|
||||
.sponsors__carousel {
|
||||
width: min(100%, 680px);
|
||||
}
|
||||
|
||||
.sponsors__logo {
|
||||
height: clamp(68px, 18vw, 86px);
|
||||
max-width: 190px;
|
||||
}
|
||||
|
||||
.journey__cards {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue