diff --git a/package-lock.json b/package-lock.json index 6731b87..1b33621 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,6 +12,7 @@ "@alveusgg/data": "github:alveusgg/data#0.37.0", "react": "^18.2.0", "react-dom": "^18.2.0", + "react-parallax-tilt": "^1.7.222", "tmi.js": "^1.8.5" }, "devDependencies": { @@ -8755,6 +8756,15 @@ "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==", "dev": true }, + "node_modules/react-parallax-tilt": { + "version": "1.7.222", + "resolved": "https://registry.npmjs.org/react-parallax-tilt/-/react-parallax-tilt-1.7.222.tgz", + "integrity": "sha512-lBB9N2QtGFkvIxsFQXM4O3V7p0oa2z9uO63TXzQTyS7MSRcycK+54iyAn/brOwkB+pouOa5yYNgUWBHzlDsDCg==", + "peerDependencies": { + "react": "^15.0.0 || ^16.0.0 || ^17.0.0 || ^18.0.0", + "react-dom": "^15.0.0 || ^16.0.0 || ^17.0.0 || ^18.0.0" + } + }, "node_modules/react-refresh": { "version": "0.11.0", "resolved": "https://registry.npmjs.org/react-refresh/-/react-refresh-0.11.0.tgz", @@ -16973,6 +16983,12 @@ "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==", "dev": true }, + "react-parallax-tilt": { + "version": "1.7.222", + "resolved": "https://registry.npmjs.org/react-parallax-tilt/-/react-parallax-tilt-1.7.222.tgz", + "integrity": "sha512-lBB9N2QtGFkvIxsFQXM4O3V7p0oa2z9uO63TXzQTyS7MSRcycK+54iyAn/brOwkB+pouOa5yYNgUWBHzlDsDCg==", + "requires": {} + }, "react-refresh": { "version": "0.11.0", "resolved": "https://registry.npmjs.org/react-refresh/-/react-refresh-0.11.0.tgz", diff --git a/package.json b/package.json index e392723..f7b008c 100644 --- a/package.json +++ b/package.json @@ -25,6 +25,7 @@ "@alveusgg/data": "github:alveusgg/data#0.37.0", "react": "^18.2.0", "react-dom": "^18.2.0", + "react-parallax-tilt": "^1.7.222", "tmi.js": "^1.8.5" }, "devDependencies": { diff --git a/src/components/ambassadorCard/AmbassadorCard.tsx b/src/components/ambassadorCard/AmbassadorCard.tsx index 5b3bb65..5a74481 100644 --- a/src/components/ambassadorCard/AmbassadorCard.tsx +++ b/src/components/ambassadorCard/AmbassadorCard.tsx @@ -18,6 +18,8 @@ import moderatorBadge from "../../assets/mod.svg"; import styles from "./ambassadorCard.module.scss"; +import Tilt from "react-parallax-tilt"; + const offsetPosition = (position: AmbassadorImage["position"]) => { const [x, y] = (position || "50% 50%").split(" "); return `${x} min(calc(${y} + 1.5rem), 0%)`; @@ -28,17 +30,29 @@ export interface AmbassadorCardProps { ambassador: AmbassadorType; onClose?: () => void; className?: string; + disableCardEffects?: boolean; } export default function AmbassadorCard(props: AmbassadorCardProps) { - const { ambassadorKey, ambassador, onClose, className } = props; + const { ambassadorKey, ambassador, onClose, className, disableCardEffects } = + props; const images = getAmbassadorImages(ambassadorKey); const mod = window?.Twitch?.ext?.viewer?.role === "broadcaster" || window?.Twitch?.ext?.viewer?.role === "moderator"; + const glareOpacity = disableCardEffects ? 0.0 : 0.3; return ( -