Skip to content

Commit c3c3644

Browse files
committed
[fix]충돌에러수정
1 parent 0d6c6be commit c3c3644

File tree

4 files changed

+0
-91
lines changed

4 files changed

+0
-91
lines changed

src/domains/main/components/mainSlide/components/MainSlide.tsx

Lines changed: 0 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -11,49 +11,24 @@ import MainSlideAbv from './pc/MainSlideAbv';
1111

1212
gsap.registerPlugin(ScrollTrigger);
1313

14-
function MainSlide({ isDesktop }: { isDesktop: boolean }) {
1514
function MainSlide({ isDesktop }: { isDesktop: boolean }) {
1615
const root = useRef<HTMLDivElement>(null);
1716
const initialRoot = useRef<HTMLDivElement>(null);
18-
const initialRoot = useRef<HTMLDivElement>(null);
1917
const [mounted, setMounted] = useState(false);
2018
const cleanupFnRef = useRef<(() => void) | null>(null);
2119

22-
useLayoutEffect(() => {
2320
useLayoutEffect(() => {
2421
setMounted(true);
2522
}, []);
26-
}, []);
2723

2824
// GSAP 초기화 - 데스크탑에서만
2925
useLayoutEffect(() => {
3026
if (!mounted || !isDesktop || !root.current) return;
31-
if (!mounted || !isDesktop || !root.current) return;
3227

3328
const el = root.current;
3429
const stage = el.querySelector('.stage') as HTMLElement;
3530
if (!stage) return;
3631

37-
const ctx = gsap.context(() => {
38-
// 첫 진입 애니메이션
39-
gsap.fromTo(
40-
initialRoot.current,
41-
{ opacity: 0 },
42-
{
43-
y: 0,
44-
opacity: 1,
45-
ease: 'power5.out',
46-
scrollTrigger: {
47-
trigger: initialRoot.current,
48-
start: 'top 80%',
49-
end: 'top top',
50-
scrub: 0.2,
51-
},
52-
}
53-
);
54-
55-
const panels = Array.from(el.querySelectorAll<HTMLElement>('.panel'));
56-
const tl = gsap.timeline({ paused: true, defaults: { ease: 'power3.inOut' } });
5732
const ctx = gsap.context(() => {
5833
// 첫 진입 애니메이션
5934
gsap.fromTo(
@@ -75,21 +50,12 @@ function MainSlide({ isDesktop }: { isDesktop: boolean }) {
7550
const panels = Array.from(el.querySelectorAll<HTMLElement>('.panel'));
7651
const tl = gsap.timeline({ paused: true, defaults: { ease: 'power3.inOut' } });
7752

78-
panels.forEach((panel, i) => {
79-
const c = panel.querySelector<HTMLElement>('.slide-content');
80-
if (!c) return;
81-
const stageW = () => stage.clientWidth;
82-
const contentW = () => c.getBoundingClientRect().width;
8353
panels.forEach((panel, i) => {
8454
const c = panel.querySelector<HTMLElement>('.slide-content');
8555
if (!c) return;
8656
const stageW = () => stage.clientWidth;
8757
const contentW = () => c.getBoundingClientRect().width;
8858

89-
gsap.set(c, {
90-
x: () => stageW(),
91-
immediateRender: false,
92-
});
9359
gsap.set(c, {
9460
x: () => stageW(),
9561
immediateRender: false,
@@ -106,27 +72,7 @@ function MainSlide({ isDesktop }: { isDesktop: boolean }) {
10672
i
10773
);
10874
});
109-
tl.to(
110-
c,
111-
{
112-
x: () => stageW() - contentW(),
113-
duration: 2,
114-
immediateRender: false,
115-
onStart: () => c.classList.remove('invisible'),
116-
},
117-
i
118-
);
119-
});
12075

121-
ScrollTrigger.create({
122-
trigger: el,
123-
start: 'top top',
124-
end: `+=${panels.length * 100}%`,
125-
pin: true,
126-
scrub: true,
127-
animation: tl,
128-
invalidateOnRefresh: true,
129-
});
13076
ScrollTrigger.create({
13177
trigger: el,
13278
start: 'top top',
@@ -139,16 +85,7 @@ function MainSlide({ isDesktop }: { isDesktop: boolean }) {
13985

14086
ScrollTrigger.refresh();
14187
}, root);
142-
ScrollTrigger.refresh();
143-
}, root);
14488

145-
cleanupFnRef.current = () => {
146-
const allTriggers = ScrollTrigger.getAll();
147-
allTriggers.forEach((st) => {
148-
if (st.trigger === el || el.contains(st.trigger as Node)) {
149-
st.kill(true);
150-
}
151-
});
15289
cleanupFnRef.current = () => {
15390
const allTriggers = ScrollTrigger.getAll();
15491
allTriggers.forEach((st) => {
@@ -157,9 +94,6 @@ function MainSlide({ isDesktop }: { isDesktop: boolean }) {
15794
}
15895
});
15996

160-
try {
161-
ctx.revert();
162-
} catch {}
16397
try {
16498
ctx.revert();
16599
} catch {}
@@ -176,36 +110,19 @@ function MainSlide({ isDesktop }: { isDesktop: boolean }) {
176110
}
177111
});
178112
};
179-
// pin-spacer 정리
180-
const pinSpacers = document.querySelectorAll('.pin-spacer');
181-
pinSpacers.forEach((spacer) => {
182-
if (spacer.contains(el) || el.contains(spacer)) {
183-
const child = spacer.querySelector('section');
184-
if (child && spacer.parentElement) {
185-
spacer.parentElement.appendChild(child);
186-
}
187-
spacer.remove();
188-
}
189-
});
190-
};
191113

192114
return () => {
193115
cleanupFnRef.current?.();
194116
cleanupFnRef.current = null;
195-
cleanupFnRef.current?.();
196-
cleanupFnRef.current = null;
197117
};
198118
}, [isDesktop, mounted]);
199-
}, [isDesktop, mounted]);
200119
// SSR 방지
201120
if (!mounted) {
202121
return null;
203122
}
204123

205124
return (
206125
<>
207-
{!isDesktop ? (
208-
<MobileSlide key="mobile" />
209126
{!isDesktop ? (
210127
<MobileSlide key="mobile" />
211128
) : (
@@ -215,22 +132,18 @@ function MainSlide({ isDesktop }: { isDesktop: boolean }) {
215132
<div className="panel absolute inset-0 overflow-hidden">
216133
<MainSlideIntro />
217134
</div>
218-
<div className="panel absolute inset-0 overflow-hidden">
219135
<div className="panel absolute inset-0 overflow-hidden">
220136
<MainSlideTest />
221137
</div>
222-
<div className="panel absolute inset-0 overflow-hidden">
223138
<div className="panel absolute inset-0 overflow-hidden">
224139
<MainSlideCommunity />
225140
</div>
226-
<div className="panel absolute inset-0 overflow-hidden">
227141
<div className="panel absolute inset-0 overflow-hidden">
228142
<MainSlideAbv />
229143
</div>
230144
</div>
231145
</section>
232146
</div>
233-
</div>
234147
)}
235148
</>
236149
);

src/domains/main/components/mainSlide/components/MainSlideIntro.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ function MainSlideIntro() {
55
<h2 className="text-3xl lg:text-[5rem] font-extrabold leading-[1.2] text-primary">
66
칵테일 <br /> 누구나 쉽게 즐길 수 있어요
77
</h2>
8-
<p className="text-2xl font-normal text-primary/80">
98
<p className="text-2xl font-normal text-primary/80">
109
SSOUL의 재밌고 다양한 기능들로 더 친근하게 접해보세요
1110
</p>

src/domains/main/components/mainSlide/components/MainTestDummy.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ function MainTestDummy({ message, option, type }: Props) {
7171
</section>
7272
)}
7373
{type == 'text' && (
74-
<div className="flex flex-row gap-2 md:overflow-x-none overflow-x-auto no-scrollbar">
7574
<div className="flex flex-row gap-2 md:overflow-x-none overflow-x-auto no-scrollbar">
7675
{DUMMY_CARD.map(({ id, src, cocktailName }) => (
7776
<MainSlideDummyCard key={id} id={id} src={src} cocktailName={cocktailName} />

src/domains/recipe/components/main/CocktailFilter.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,8 @@ import { useRouter } from 'next/navigation';
33

44
interface Props {
55
cocktailsEA: number;
6-
cocktailsEA: number;
76
}
87

9-
function CocktailFilter({ cocktailsEA }: Props) {
108
function CocktailFilter({ cocktailsEA }: Props) {
119
const sortMap = {
1210
최신순: 'recent',

0 commit comments

Comments
 (0)