Skip to content

Commit eae2dc3

Browse files
committed
smooth homepage hero hydration
1 parent 2609b75 commit eae2dc3

1 file changed

Lines changed: 5 additions & 72 deletions

File tree

Lines changed: 5 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,10 @@
1-
import Avatar from "@/components/Avatar";
21
import DeferredIntroHeaderRotator from "@/components/DeferredIntroHeaderRotator";
3-
import MapPin from "@/components/MapPin";
4-
import { css, keyframes, styled } from "next-yak";
5-
6-
const avatarVisible = {
7-
opacity: 1,
8-
transform: "rotate(-15deg) translate(-1.5rem, -1rem) scale(1)",
9-
};
10-
const markerVisible = {
11-
opacity: 1,
12-
transform: "rotate(12deg) translate(2.75rem, 1rem) scale(1)",
13-
};
14-
const mapEnter = {
15-
opacity: 0,
16-
transform: "scale(1, 0.9) rotateX(-10deg) translateY(1rem)",
17-
};
18-
const mapVisible = {
19-
opacity: 1,
20-
transform: "scale(1, 1) rotateX(0deg) translateY(0)",
21-
};
22-
23-
const mapEnterAnimation = keyframes`
24-
from {
25-
opacity: ${mapEnter.opacity};
26-
transform: ${mapEnter.transform};
27-
}
28-
29-
to {
30-
opacity: ${mapVisible.opacity};
31-
transform: ${mapVisible.transform};
32-
}
33-
`;
34-
35-
const staticHeroItem = {
36-
type: "residential",
37-
photo: "compost-collective-kc.jpg",
38-
} as const;
2+
import { styled } from "next-yak";
393

404
export default function IntroHeader() {
415
return (
426
<Frame>
43-
<MapContainer>
44-
<MarkerDemo>
45-
<MapPin selected={true} type={staticHeroItem.type} />
46-
</MarkerDemo>
47-
<StyledAvatar
48-
isDemo={true}
49-
src={`/avatars/featured/${staticHeroItem.photo}`}
50-
alt=""
51-
size="massive"
52-
priority
53-
/>
54-
</MapContainer>
7+
<MapContainer />
558
<RotatorLayer aria-hidden="true">
569
<DeferredIntroHeaderRotator />
5710
</RotatorLayer>
@@ -67,7 +20,7 @@ const Frame = styled.div`
6720
margin-bottom: -2.5rem;
6821
`;
6922

70-
const sharedMapContainerStyles = css`
23+
const MapContainer = styled.div`
7124
display: flex;
7225
flex-direction: row;
7326
gap: 1rem;
@@ -90,33 +43,13 @@ const sharedMapContainerStyles = css`
9043
mask-image: radial-gradient(black 0%, transparent 74%);
9144
border-radius: inherit;
9245
z-index: -1;
93-
opacity: ${mapEnter.opacity};
94-
transform: ${mapEnter.transform};
95-
animation: ${mapEnterAnimation} 1100ms forwards;
96-
animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1.055);
46+
opacity: 1;
47+
transform: scale(1, 1) rotateX(0deg) translateY(0);
9748
transform-origin: bottom center;
9849
}
9950
`;
10051

101-
const MapContainer = styled.div`
102-
${sharedMapContainerStyles}
103-
`;
104-
10552
const RotatorLayer = styled.div`
10653
position: absolute;
10754
inset: 0;
10855
`;
109-
110-
const StyledAvatar = styled(Avatar)`
111-
position: absolute;
112-
opacity: ${avatarVisible.opacity};
113-
transform: ${avatarVisible.transform};
114-
transform-origin: bottom right;
115-
`;
116-
117-
const MarkerDemo = styled.div`
118-
position: absolute;
119-
opacity: ${markerVisible.opacity};
120-
transform: ${markerVisible.transform};
121-
transform-origin: bottom left;
122-
`;

0 commit comments

Comments
 (0)