Skip to content

Commit

Permalink
fix(landing): update animation trigger (#184)
Browse files Browse the repository at this point in the history
  • Loading branch information
danilowoz authored Nov 25, 2021
1 parent 6eccfee commit 8c94cd7
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
7 changes: 5 additions & 2 deletions website/landing/components/AdvancedUsage/UsageExample.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@ export const UsageExample: React.FC<UsageExampleProps> = ({
exampleIndex,
}) => {
const shouldAnimate = useBreakpoint("bp2");
const { ref, inView } = useInView({ threshold: 0 });
const { ref, inView } = useInView({
threshold: 0,
triggerOnce: !shouldAnimate,
});

return (
<Box css={{ height: "100vh", maxHeight: "1080px" }}>
Expand Down Expand Up @@ -52,7 +55,7 @@ export const UsageExample: React.FC<UsageExampleProps> = ({
<Box ref={ref}>
<ExampleIllustration
illustrationKey={example.illustrationKey}
visible={!shouldAnimate || inView}
visible={inView}
/>
</Box>
<Box>
Expand Down
1 change: 1 addition & 0 deletions website/landing/components/Intro/Examples.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export const Examples: React.FC = () => {
const { layoutFiles, visibility } = useLayoutExampleContext();

const { scrollY } = useViewportScroll();

const isMedium = useBreakpoint("bp2");
const isLarge = useBreakpoint("bp3");
const isXLarge = useBreakpoint("2260");
Expand Down
3 changes: 1 addition & 2 deletions website/landing/components/Showcase/Showcase.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ const HighlightPreview: React.FC<{ source: string; alt: string }> = ({
background: "$surface",
color: "white",
display: "flex",
height: "595px",
justifyContent: "center",
margin: "0 auto",
width: "100%",
Expand All @@ -50,7 +49,7 @@ const HighlightPreview: React.FC<{ source: string; alt: string }> = ({
},
}}
>
<Image alt={alt} height={720} src={source} width={480} />
<Image alt={alt} height={1440} src={source} width={960} />
</Box>
);
};
Expand Down
1 change: 1 addition & 0 deletions website/landing/components/Users/Users.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ export const Users: React.FC = () => {
// and then do an opacity transition.
const { ref: listRef, inView } = useInView({
threshold: [0, 1],
triggerOnce: !shouldAnimate,
});

return (
Expand Down

0 comments on commit 8c94cd7

Please sign in to comment.