fix(web): stabilize hero whale hover
This commit is contained in:
@@ -68,6 +68,13 @@ describe('web e2e: startup auto-selection', () => {
|
|||||||
it('keeps the resident Hero and composer nodes when the first Workspace session appears', async () => {
|
it('keeps the resident Hero and composer nodes when the first Workspace session appears', async () => {
|
||||||
onTestFailed(() => saveFailureShot(page, 'web-e2e-first-workspace-stable-tree'))
|
onTestFailed(() => saveFailureShot(page, 'web-e2e-first-workspace-stable-tree'))
|
||||||
await page.locator(`${ROOT_PHASE}[data-phase="hero"]`).waitFor({ timeout: 15_000 })
|
await page.locator(`${ROOT_PHASE}[data-phase="hero"]`).waitFor({ timeout: 15_000 })
|
||||||
|
const headline = page.getByText('Into the Unknown', { exact: true })
|
||||||
|
const fish = headline.locator('xpath=preceding-sibling::span[1]/*[name()="svg"]')
|
||||||
|
const fishHitbox = fish.locator('..')
|
||||||
|
expect(await fish.evaluate(node => getComputedStyle(node).color))
|
||||||
|
.toBe(await headline.evaluate(node => getComputedStyle(node).color))
|
||||||
|
await fishHitbox.hover()
|
||||||
|
expect(await fish.evaluate(node => getComputedStyle(node).animationName)).not.toBe('none')
|
||||||
await page.evaluate(() => {
|
await page.evaluate(() => {
|
||||||
const refs = {
|
const refs = {
|
||||||
root: document.querySelector('div[data-phase="hero"]'),
|
root: document.querySelector('div[data-phase="hero"]'),
|
||||||
|
|||||||
@@ -118,7 +118,9 @@ export function HeroShell({ t, children }: HeroShellProps) {
|
|||||||
<div className={css.stack}>
|
<div className={css.stack}>
|
||||||
<div className={css.headline}>
|
<div className={css.headline}>
|
||||||
{/* figma 34:10412: fish 34×25 leading the headline, gap 10. */}
|
{/* figma 34:10412: fish 34×25 leading the headline, gap 10. */}
|
||||||
<FishLogo size={34} className={css.fish} />
|
<span className={css.fishHitbox}>
|
||||||
|
<FishLogo size={34} className={css.fish} />
|
||||||
|
</span>
|
||||||
<span className={css.headlineText}>{t('hero.headline')}</span>
|
<span className={css.headlineText}>{t('hero.headline')}</span>
|
||||||
<span className={css.previewBadge}>{t('hero.preview')}</span>
|
<span className={css.previewBadge}>{t('hero.preview')}</span>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -61,12 +61,18 @@
|
|||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Keep the hero mark in the same primary ink as its headline. */
|
/* Keep hover detection on a stationary box while the mark moves within it. */
|
||||||
.fish {
|
.fishHitbox {
|
||||||
grid-row: 1;
|
grid-row: 1;
|
||||||
grid-column: 1;
|
grid-column: 1;
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Keep the hero mark in the same primary ink as its headline. */
|
||||||
|
.fish {
|
||||||
color: var(--dsw-alias-label-primary);
|
color: var(--dsw-alias-label-primary);
|
||||||
transform-box: fill-box;
|
|
||||||
transform-origin: 50% 60%;
|
transform-origin: 50% 60%;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -85,8 +91,8 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
@media (hover: hover) and (prefers-reduced-motion: no-preference) {
|
@media (hover: hover) and (prefers-reduced-motion: no-preference) {
|
||||||
.fish:hover {
|
.fishHitbox:hover .fish {
|
||||||
animation: hero-fish-swim 560ms cubic-bezier(0.2, 0.8, 0.2, 1);
|
animation: hero-fish-swim var(--ds-transition-duration-slow) var(--ds-ease-in-out);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user