Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/core/src/theme/components/HomeFeature/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const getGridClass = (feature: Feature): string => {
function HomeFeatureItem({ feature }: { feature: Feature }): JSX.Element {
const { icon, title, details, link } = feature;

const { innerProps, outerProps, outerRef, shineDom } = useCardAnimation();
const { outerProps, outerRef, shineDom } = useCardAnimation();
const navigate = useLinkNavigate();

return (
Expand All @@ -36,7 +36,7 @@ function HomeFeatureItem({ feature }: { feature: Feature }): JSX.Element {
className={`rp-home-feature__item ${getGridClass(feature)}`}
ref={outerRef}
>
<div className="rp-home-feature__item-wrapper" {...innerProps}>
<div className="rp-home-feature__item-wrapper">
<article
key={title}
className={`rp-home-feature__card ${link ? 'rp-home-feature__card--clickable' : ''}`}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ export const useCardAnimation = () => {

let shine: string;
let shineBg: string;
let container: string;
let outerContainer: string;
const handleEnter = () => {
setIsHovering(true);
};
Expand All @@ -40,17 +38,13 @@ export const useCardAnimation = () => {
const bodyScrollLeft = document.body.scrollLeft;

const offsets = ele.getBoundingClientRect();
const wMultiple = 320 / rootElemWidth;
const multiple = wMultiple * 0.05;
const offsetX =
0.52 - (pageX - offsets.left - bodyScrollLeft) / rootElemWidth;
const offsetY =
0.52 - (pageY - offsets.top - bodyScrollTop) / rootElemHeight;
const dy = pageY - offsets.top - bodyScrollTop - rootElemHeight / 2;
const dx = pageX - offsets.left - bodyScrollLeft - rootElemWidth / 2;
const yRotate = (offsetX - dx) * multiple;
const xRotate =
(dy - offsetY) * (Math.min(offsets.width / offsets.height, 1) * multiple);

const arad = Math.atan2(dy, dx);
const rawAngle = (arad * 180) / Math.PI - 90;
const angle = rawAngle < 0 ? rawAngle + 360 : rawAngle;
Expand All @@ -60,20 +54,14 @@ export const useCardAnimation = () => {
((pageY - offsets.top - bodyScrollTop) / rootElemHeight) * 0.2
}) 0%, rgba(255, 255, 255, 0) 50%)`;

container = `rotateX(${xRotate}deg) rotateY(${yRotate}deg)`;
outerContainer = `perspective(${rootElemWidth * 2}px)`;
// container = `rotateX(${xRotate}deg) rotateY(${yRotate}deg)`;
// outerContainer = `perspective(${rootElemWidth * 2}px)`;
Copy link

Copilot AI Nov 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Commented-out code should be removed entirely instead of being left in the codebase. Since the 3D animation feature is being removed, these lines should be deleted rather than commented out.

Suggested change
// outerContainer = `perspective(${rootElemWidth * 2}px)`;

Copilot uses AI. Check for mistakes.
} else {
shine = '';
shineBg = '';
container = '';
outerContainer = '';
}

const outerProps: HTMLAttributes<HTMLDivElement> = {
style: {
transform: outerContainer,
transformStyle: 'preserve-3d',
},
onMouseEnter: handleEnter,
onMouseLeave: handleLeave,
onMouseMove: handleMove,
Expand All @@ -83,12 +71,6 @@ export const useCardAnimation = () => {
};
const outerRef = ref;

const innerProps = {
style: {
transform: container,
},
};

const shineDom = (
<div
className="rp-home-feature__item__shine"
Expand Down Expand Up @@ -119,7 +101,6 @@ export const useCardAnimation = () => {
return {
outerProps,
outerRef,
innerProps,
shineDom,
};
};
Loading