♻️(react) disable animation when Chromatic is running
We need to disable Javascript animation when Chromatic is taking snapshots in order to avoid having changes detected each time a build is ran.
This commit is contained in:
@@ -6,6 +6,7 @@ import React, {
|
||||
useRef,
|
||||
} from "react";
|
||||
import classNames from "classnames";
|
||||
import isChromatic from "chromatic/isChromatic";
|
||||
import { Button, ButtonProps } from ":/components/Button";
|
||||
import { iconFromType, VariantType } from ":/utils/VariantUtils";
|
||||
|
||||
@@ -105,6 +106,9 @@ export const ProgressBar = ({ duration }: { duration: number }) => {
|
||||
const content = useRef<HTMLDivElement>(null);
|
||||
|
||||
useEffect(() => {
|
||||
if (isChromatic()) {
|
||||
return;
|
||||
}
|
||||
content.current!.animate([{ width: "0%" }, { width: "100%" }], {
|
||||
duration,
|
||||
easing: "linear",
|
||||
|
||||
Reference in New Issue
Block a user