Merge branch 'fix/portrait-overflow'
This commit is contained in:
commit
5486459863
2 changed files with 68 additions and 4 deletions
|
|
@ -42,6 +42,53 @@ describe('homepage hero', () => {
|
||||||
.and('have.attr', 'alt')
|
.and('have.attr', 'alt')
|
||||||
.and('match', /Rabbi Yehoshua Gerzi/i)
|
.and('match', /Rabbi Yehoshua Gerzi/i)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('lets the rabbi portrait rise above the circular frame', () => {
|
||||||
|
cy.get<HTMLImageElement>('[data-cy="hero-portrait"]').then(
|
||||||
|
(portraitElements) => {
|
||||||
|
const portraitImage = portraitElements[0]
|
||||||
|
const frameElement = portraitImage.parentElement
|
||||||
|
|
||||||
|
if (frameElement === null) {
|
||||||
|
throw new Error('Portrait frame is missing')
|
||||||
|
}
|
||||||
|
|
||||||
|
const frameStyle = getComputedStyle(frameElement)
|
||||||
|
|
||||||
|
expect(frameStyle.overflowX).to.equal('visible')
|
||||||
|
expect(frameStyle.overflowY).to.equal('visible')
|
||||||
|
expect(portraitImage.getBoundingClientRect().top).to.be.lessThan(
|
||||||
|
frameElement.getBoundingClientRect().top,
|
||||||
|
)
|
||||||
|
},
|
||||||
|
)
|
||||||
|
})
|
||||||
|
|
||||||
|
it('extends the circular background to the portrait base edges', () => {
|
||||||
|
cy.get<HTMLImageElement>('[data-cy="hero-portrait"]').then(
|
||||||
|
(portraitElements) => {
|
||||||
|
const portraitImage = portraitElements[0]
|
||||||
|
const frameElement = portraitImage.parentElement
|
||||||
|
|
||||||
|
if (frameElement === null) {
|
||||||
|
throw new Error('Portrait frame is missing')
|
||||||
|
}
|
||||||
|
|
||||||
|
const portraitBounds = portraitImage.getBoundingClientRect()
|
||||||
|
const frameBounds = frameElement.getBoundingClientRect()
|
||||||
|
const backgroundStyle = getComputedStyle(frameElement, '::before')
|
||||||
|
const backgroundWidth = Number.parseFloat(backgroundStyle.width)
|
||||||
|
const backgroundLeft =
|
||||||
|
frameBounds.left + (frameBounds.width - backgroundWidth) / 2
|
||||||
|
const backgroundRight = backgroundLeft + backgroundWidth
|
||||||
|
|
||||||
|
expect(backgroundStyle.content).to.not.equal('none')
|
||||||
|
expect(backgroundWidth).to.be.closeTo(portraitBounds.width, 1)
|
||||||
|
expect(backgroundLeft).to.be.closeTo(portraitBounds.left, 1)
|
||||||
|
expect(backgroundRight).to.be.closeTo(portraitBounds.right, 1)
|
||||||
|
},
|
||||||
|
)
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('homepage discover path section', () => {
|
describe('homepage discover path section', () => {
|
||||||
|
|
|
||||||
|
|
@ -468,17 +468,34 @@ const projects: Project[] = [
|
||||||
}
|
}
|
||||||
|
|
||||||
.hero__portrait-frame {
|
.hero__portrait-frame {
|
||||||
width: clamp(180px, 22vw, 320px);
|
--portrait-frame-size: clamp(180px, 22vw, 320px);
|
||||||
aspect-ratio: 1;
|
|
||||||
|
width: var(--portrait-frame-size);
|
||||||
|
height: var(--portrait-frame-size);
|
||||||
|
position: relative;
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
background: var(--color-slate);
|
overflow: visible;
|
||||||
overflow: hidden;
|
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: flex-end;
|
align-items: flex-end;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.hero__portrait-frame::before {
|
||||||
|
content: '';
|
||||||
|
position: absolute;
|
||||||
|
left: 50%;
|
||||||
|
bottom: 0;
|
||||||
|
z-index: 0;
|
||||||
|
width: 110%;
|
||||||
|
aspect-ratio: 1;
|
||||||
|
border-radius: 50%;
|
||||||
|
background: var(--color-slate);
|
||||||
|
transform: translateX(-50%);
|
||||||
|
}
|
||||||
|
|
||||||
.hero__portrait {
|
.hero__portrait {
|
||||||
|
position: relative;
|
||||||
|
z-index: 1;
|
||||||
width: 110%;
|
width: 110%;
|
||||||
height: auto;
|
height: auto;
|
||||||
display: block;
|
display: block;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue