-
Notifications
You must be signed in to change notification settings - Fork 38
fix: improve Lighthouse LCP scores for guides and landing apps #2304
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
0c44ac4
05d4da6
96db421
741a807
f9687ff
e5f82e1
06e92a0
8bc43ef
40095d4
71eec22
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| 1.3.14 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,5 @@ | ||
| 'use client'; | ||
|
|
||
| import { AnimatePresence, motion } from 'framer-motion'; | ||
| import { assertDefined } from 'landing-app/lib/typeAssertions'; | ||
| import Image from 'next/image'; | ||
| import { useEffect, useState } from 'react'; | ||
|
|
||
|
|
@@ -29,28 +27,24 @@ export default function AppPreview() { | |
| return () => clearInterval(interval); | ||
| }, [screens.length]); | ||
|
|
||
| assertDefined(screens[currentScreen]); | ||
|
|
||
| return ( | ||
| <> | ||
| <AnimatePresence mode="wait"> | ||
| <motion.div | ||
| key={currentScreen} | ||
| initial={{ opacity: 0 }} | ||
| animate={{ opacity: 1 }} | ||
| exit={{ opacity: 0 }} | ||
| transition={{ duration: 0.5 }} | ||
| className="absolute inset-0" | ||
| {screens.map((screen, index) => ( | ||
| <div | ||
| key={screen.src} | ||
| className={`absolute inset-0 transition-opacity duration-500 ${ | ||
| index === currentScreen ? 'opacity-100' : 'opacity-0' | ||
| }`} | ||
| > | ||
| <Image | ||
| src={screens[currentScreen].src || '/placeholder.svg'} | ||
| alt={screens[currentScreen].alt} | ||
| src={screen.src} | ||
| alt={screen.alt} | ||
| fill | ||
| className="object-cover" | ||
| priority | ||
| priority={index === 0} | ||
| /> | ||
|
Comment on lines
+32
to
45
|
||
| </motion.div> | ||
| </AnimatePresence> | ||
| </div> | ||
| ))} | ||
| <div className="absolute bottom-5 left-0 right-0 flex justify-center gap-2 z-10"> | ||
| {screens.map((_, index) => ( | ||
| <button | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Setting
scroll-behavior: smoothunconditionally can cause motion/vestibular issues for users who prefer reduced motion. Consider applying smooth scrolling only under@media (prefers-reduced-motion: no-preference)(and falling back toautootherwise).