Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(CLAP-181): 모바일뷰에서 핀컨테이너 터치이벤트 추가 #128

Merged
merged 4 commits into from
Aug 25, 2024
Merged
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
2 changes: 1 addition & 1 deletion packages/service/src/apis/partsEvent/apiPatchMyParts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ export const apiPatchMyParts = (token: string, partsId: number) => {
Authorization: `Bearer ${token}`,
},
},
).then(() => console.log(partsId));
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,20 @@ export const pinItemBottom = css`
z-index: 22;
`;

export const pinLine = css`
export const pinLineContainer = css`
position: absolute;
width: 100px;
height: 100%;
`;

export const pinLine = css`
position: relative;
background: linear-gradient(to bottom, transparent, ${theme.color.white});
transform: translateY(14px);
width: 1px;
height: 100%;
z-index: 9;
left: 50px;

filter: blur(0.5px);
`;
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,30 @@ import { IParts } from "@watermelon-clap/core/src/types";
interface PinMarkerProps {
parts?: IParts;
opacity: number;
handleOnTouchEnd: (event: React.TouchEvent<HTMLDivElement>) => void;
customCss?: SerializedStyles;
imgCss?: SerializedStyles;
}

export const Pin = ({ parts, opacity, customCss, imgCss }: PinMarkerProps) => {
export const Pin = ({
parts,
opacity,
handleOnTouchEnd,
customCss,
imgCss,
}: PinMarkerProps) => {
const { openModal } = useModal();

const handleDescriptionButtonClick = () => {
openModal({
type: "description",
props: {
src: parts?.thumbnailImgSrc,
name: parts?.name,
description: parts?.description,
},
});
opacity === 1 &&
openModal({
type: "description",
props: {
src: parts?.thumbnailImgSrc,
name: parts?.name,
description: parts?.description,
},
});
};

return (
Expand All @@ -48,9 +56,16 @@ export const Pin = ({ parts, opacity, customCss, imgCss }: PinMarkerProps) => {
</div>
</motion.div>
{/* Line */}
<motion.div css={style.pinLine} />
<motion.div
css={style.pinLineContainer}
onTouchEnd={(event) => handleOnTouchEnd(event)}
>
<motion.div css={style.pinLine} />
</motion.div>
{/* Circle */}
<WaveCircle />
<motion.div onTouchEnd={(event) => handleOnTouchEnd(event)}>
<WaveCircle />
</motion.div>
</motion.div>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,25 @@ export const PinContainer = ({
setPerspectiveOpacity(0);
};

const handleOnTouchEnd = (event: React.TouchEvent<HTMLDivElement>) => {
event.stopPropagation();
event.preventDefault();

if (perspectiveOpacity === 1) onMouseLeave();
else onMouseEnter();
};

return (
<div css={styles.mainContainer}>
<div
css={styles.pivotContainer}
onMouseEnter={onMouseEnter}
onMouseLeave={onMouseLeave}
>
<div css={styles.perspectiveContainer}>
<div
css={styles.perspectiveContainer}
onTouchEnd={(event) => handleOnTouchEnd(event)}
>
<div style={{ transform }} css={styles.innerContainer}>
{children}
</div>
Expand All @@ -52,6 +63,7 @@ export const PinContainer = ({
<Pin
parts={equippedParts.colorParts}
opacity={perspectiveOpacity}
handleOnTouchEnd={handleOnTouchEnd}
imgCss={styles.pinCommonImg}
customCss={styles.pinCommonCustom}
/>
Expand All @@ -61,6 +73,7 @@ export const PinContainer = ({
<Pin
parts={equippedParts.bgParts}
opacity={perspectiveOpacity}
handleOnTouchEnd={handleOnTouchEnd}
imgCss={styles.pinBgImg}
customCss={styles.pinBgCustom}
/>
Expand All @@ -70,6 +83,7 @@ export const PinContainer = ({
<Pin
parts={equippedParts.wheelParts}
opacity={perspectiveOpacity}
handleOnTouchEnd={handleOnTouchEnd}
imgCss={styles.pinWheelImg}
customCss={styles.pinWheelCustom}
/>
Expand All @@ -79,6 +93,7 @@ export const PinContainer = ({
<Pin
parts={equippedParts.spoilerParts}
opacity={perspectiveOpacity}
handleOnTouchEnd={handleOnTouchEnd}
imgCss={styles.pinSpoilerImg}
customCss={styles.pinSpoilerCustom}
/>
Expand Down
Loading