update 404 page performance
This commit is contained in:
parent
3a5e1f07cf
commit
b7c69fb781
@ -13,6 +13,26 @@ interface WobblingImageInterface {
|
||||
}
|
||||
}
|
||||
|
||||
interface ImageClipInterface {
|
||||
name: string;
|
||||
src: string;
|
||||
size: number;
|
||||
visible?: boolean;
|
||||
}
|
||||
|
||||
const ImageClip: React.FC<ImageClipInterface> = ({
|
||||
name, src, size, visible
|
||||
}) => (
|
||||
<Image
|
||||
className={clsx("absolute left-1/2 -translate-x-1/2 top-0 pointer-events-none", visible ? "opacity-100" : "opacity-0")}
|
||||
alt={name}
|
||||
src={src}
|
||||
width={size}
|
||||
height={size}
|
||||
draggable={false}
|
||||
/>
|
||||
)
|
||||
|
||||
function WobblingImage ({
|
||||
images
|
||||
}: WobblingImageInterface) {
|
||||
@ -128,21 +148,23 @@ function WobblingImage ({
|
||||
onMouseDown={(e) => e.preventDefault()}
|
||||
onPointerDown={(e) => e.preventDefault()}
|
||||
>
|
||||
<Image
|
||||
className={clsx("absolute left-1/2 -translate-x-1/2 top-0 pointer-events-none", isPoked ? "opacity-0" : "opacity-100")}
|
||||
alt="clip1"
|
||||
src={isAware ? (images.aware || images.idle) : images.idle}
|
||||
width={size}
|
||||
height={size}
|
||||
draggable={false}
|
||||
<ImageClip
|
||||
name="idle"
|
||||
src={images.idle}
|
||||
size={size}
|
||||
visible={!isPoked && !isAware}
|
||||
/>
|
||||
<Image
|
||||
className={clsx("absolute left-1/2 -translate-x-1/2 top-0 pointer-events-none", isPoked ? "opacity-100" : "opacity-0")}
|
||||
alt="clip2"
|
||||
<ImageClip
|
||||
name="aware"
|
||||
src={images.aware || images.idle}
|
||||
size={size}
|
||||
visible={!isPoked && isAware}
|
||||
/>
|
||||
<ImageClip
|
||||
name="poked"
|
||||
src={images.poked || images.idle}
|
||||
width={size}
|
||||
height={size}
|
||||
draggable={false}
|
||||
size={size}
|
||||
visible={isPoked}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user