-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'fe-dev' into feature/#782
- Loading branch information
Showing
34 changed files
with
451 additions
and
140 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 0 additions & 15 deletions
15
client/src/components/KakaoInitializer/KakaoInitializer.tsx
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import {useEffect, useState} from 'react'; | ||
|
||
type UseImageLazyLoadingProps<T extends HTMLElement> = { | ||
targetRef: React.RefObject<T>; | ||
src: string; | ||
threshold?: number; | ||
}; | ||
|
||
const useImageLazyLoading = <T extends HTMLElement>({ | ||
targetRef, | ||
src, | ||
threshold = 0.05, | ||
}: UseImageLazyLoadingProps<T>) => { | ||
const [imageSrc, setImageSrc] = useState<string | undefined>(undefined); | ||
|
||
useEffect(() => { | ||
if (targetRef && !imageSrc) { | ||
const observer = new IntersectionObserver( | ||
([entry]) => { | ||
if (entry.isIntersecting) { | ||
setImageSrc(src); | ||
if (targetRef.current) { | ||
observer.unobserve(targetRef.current); | ||
} | ||
} | ||
}, | ||
{threshold}, | ||
); | ||
|
||
if (targetRef.current) { | ||
observer.observe(targetRef.current); | ||
} | ||
|
||
return () => { | ||
if (targetRef.current) { | ||
observer.unobserve(targetRef.current); | ||
} | ||
}; | ||
} | ||
|
||
return; | ||
}, [targetRef, src]); | ||
|
||
return { | ||
imageSrc, | ||
}; | ||
}; | ||
|
||
export default useImageLazyLoading; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import {useEffect, useRef} from 'react'; | ||
|
||
const useMainPageYScroll = () => { | ||
const featureSectionRef = useRef<HTMLDivElement>(null); | ||
const translateX = useRef(0); | ||
|
||
useEffect(() => { | ||
const handleScroll = () => { | ||
if (featureSectionRef.current) { | ||
const featureSectionTop = featureSectionRef.current.offsetTop; | ||
const scrollY = window.scrollY; | ||
|
||
if (scrollY >= featureSectionTop && translateX.current < window.innerWidth * 4) { | ||
window.scrollTo(0, featureSectionTop); | ||
translateX.current += scrollY - featureSectionTop; | ||
const newTransform = `translateX(calc(200vw - ${translateX.current > 0 ? translateX.current : 0}px))`; | ||
featureSectionRef.current.style.transform = newTransform; | ||
} | ||
if (scrollY <= featureSectionTop && translateX.current > 0) { | ||
window.scrollTo(0, featureSectionTop); | ||
translateX.current += scrollY - featureSectionTop; | ||
const newTransform = `translateX(calc(200vw - ${translateX.current < window.innerWidth * 4 ? translateX.current : window.innerWidth * 4}px))`; | ||
featureSectionRef.current.style.transform = newTransform; | ||
} | ||
} | ||
}; | ||
|
||
window.addEventListener('scroll', handleScroll); | ||
return () => window.removeEventListener('scroll', handleScroll); | ||
}, []); | ||
|
||
return {featureSectionRef}; | ||
}; | ||
|
||
export default useMainPageYScroll; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import {useEffect, useState} from 'react'; | ||
import {useNavigate} from 'react-router-dom'; | ||
|
||
import {ROUTER_URLS} from '@constants/routerUrls'; | ||
|
||
const useMainSectionBackgroundScroll = (trackStartCreateEvent: () => void) => { | ||
const navigate = useNavigate(); | ||
|
||
const handleClick = () => { | ||
trackStartCreateEvent(); | ||
navigate(ROUTER_URLS.createEvent); | ||
}; | ||
|
||
const [isVisible, setIsVisible] = useState(true); | ||
|
||
useEffect(() => { | ||
const handleScroll = () => { | ||
setIsVisible(window.scrollY <= window.innerHeight); | ||
}; | ||
|
||
window.addEventListener('scroll', handleScroll); | ||
return () => window.removeEventListener('scroll', handleScroll); | ||
}, []); | ||
|
||
return {isVisible, handleClick}; | ||
}; | ||
|
||
export default useMainSectionBackgroundScroll; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
17 changes: 17 additions & 0 deletions
17
client/src/pages/MainPage/Section/CreatorSection/Avatar.style.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import {css} from '@emotion/react'; | ||
|
||
export const avatarStyle = css({ | ||
display: 'flex', | ||
flexDirection: 'column', | ||
alignItems: 'center', | ||
gap: '0.5rem', | ||
'@media (min-width: 1200px)': { | ||
gap: '1rem', | ||
}, | ||
}); | ||
|
||
export const avatarImageStyle = css({ | ||
width: '100%', | ||
height: '100%', | ||
borderRadius: '25%', | ||
}); |
Oops, something went wrong.