Skip to content

Commit 3b6f605

Browse files
committed
applied feedback
1 parent e68d864 commit 3b6f605

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

scrollytelling/src/components/stagger/index.tsx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import * as React from "react";
66
import { StaggerBaseDef, TweenWithChildrenDef, TweenWithTargetDef } from "../../types";
77
import { Animation } from "../animation";
8+
import { isDev } from "../../util";
89

910
export function Stagger(
1011
props: StaggerBaseDef & {
@@ -33,7 +34,11 @@ export function Stagger({
3334

3435
const timeline = React.useMemo(() => {
3536
if(tween?.start === undefined || tween?.end === undefined) {
36-
throw new Error('Stagger must have start and end');
37+
if (isDev) {
38+
console.warn('Stagger needs a start and end value');
39+
}
40+
41+
return [];
3742
}
3843

3944
return getStaggeredTimeline(
@@ -135,8 +140,8 @@ export function Stagger({
135140
}
136141
}
137142
);
138-
} else {
139-
throw new Error('Stagger target must be an array');
143+
} else if (isDev) {
144+
console.warn('Stagger target must be an array');
140145
}
141146
}
142147

scrollytelling/src/util/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,3 +103,5 @@ export function getValidAt(at: number) {
103103
}
104104
return at;
105105
}
106+
107+
export const isDev = process.env.NODE_ENV === "development";

turbo.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"$schema": "https://turborepo.org/schema.json",
3+
"globalEnv": ["NODE_ENV"],
34
"pipeline": {
45
"build": {
56
"dependsOn": ["^build"],

0 commit comments

Comments
 (0)