codestates / codestates/Bobpago
[πDev Log] κΉμ°μ / 2021.09.30
- Dominant language
- TypeScript
- Stars
- 5
- Forks
- 3
- PR merge metrics
- No merged PRs in 30d
Description
### μ€λμ μ΄λ»κ² νλ‘μ νΈμ κΈ°μ¬νλμ?
- λ©μΈ μμΈ νμ΄μ§ axios ꡬν λ° λ²κ·Έ ν½μ€
- μ€λ¬Έμ‘°μ¬ νμ΄μ§λ‘ λ€μ μ΄λνμ λ, λ²νΌμ΄ μΌμ Έμλ λ²κ·Έ ν½μ€
- ν°νΈ λ°μ΄ν° μμ
### μ€λμ νλ‘μ νΈμμ νλ μ μ 무μμΈκ°μ?
- μμΈ λ μνΌ νμ΄μ§ ꡬννλλ° μμ΄μ useEffectμ λ‘λ©μ κ΄λ ¨λ λ‘μ§μ μ§λ κ²μ΄ κ½€ μκ°μ΄ μ€λκ±Έλ Έλ€.
```js
// μ½λλ₯Ό 첨λΆν΄λ μ’μ΅λλ€.
useEffect(() => {
handlePageData();
}, []);
useEffect(() => {
}, [handlePageData]);
useEffect(() => {
if (recipeData !== null) {
gsap.registerPlugin(ScrollToPlugin, ScrollTrigger);
setLoading(false);
return () => {};
}
}, [recipeData]);
useEffect(() => {
if (loading === false) {
dispatch({ type: SET_DETAIL_DATA, payload: recipeData });
setStart(true);
const totalLength = recipeData.recipe.descriptions.length;
const moveRatio = 100 / totalLength;
const goToSection = (i: number, anim?: any) => {
gsap.to(window, {
scrollTo: { y: i * window.innerHeight, autoKill: false },
duration: 0.5,
});
const image = document.body.querySelector(
".image"
) as HTMLParagraphElement;
const rightScroll = document.body.querySelector(
".rightScroll"
) as HTMLParagraphElement;
const topBox = document.body.querySelector(
".topbox"
) as HTMLParagraphElement;
const leftBox = document.body.querySelector(
".leftbox"
) as HTMLParagraphElement;
const rightBox = document.body.querySelector(
".rightbox"
) as HTMLParagraphElement;
const main = document.body.querySelector(
".main"
) as HTMLParagraphElement;
const sub = document.body.querySelector(".sub") as HTMLParagraphElement;
const totalMap = document.body.querySelectorAll(
".totalMap"
) as NodeListOf;
[...totalMap].map((item: any) => {
if ([...item.classList].includes(String(i))) {
item.classList.add("mapActive");
} else {
item.classList.remove("mapActive");
}
});
if (
rightScroll &&
topBox &&
leftBox &&
rightBox &&
image &&
main &&
sub
) {
rightScroll.style.transform = `translateY(${i * -262}px)`;
topBox.style.transform = `translateY(${i * -100}%)`;
leftBox.style.transform = `translateX(${i * -moveRatio}%)`;
rightBox.style.transform = `translateX(${
moveRatio - 100 - moveRatio * -i
}%)`;
image.style.transform = `translateY(${i * -100}%)`;
main.style.transform = `translateY(${i * -100}%)`;
sub.style.transform = `translateY(${i * -100}%)`;
}
if (anim) {
anim.restart();
}
};
```
### λ΄μΌμ νλ‘μ νΈμ κΈ°μ¬νκΈ° μν΄ λ¬΄μμ ν΄μΌ νλμ?
- [ ] μκ° νμ΄μ§ ꡬνμ μν΄ νμ¨λ³΄λ €κ³ νλ€.
- [ ] μ°μ μ€λ axios ν΅μ μ λ§λ¬΄λ¦¬ μ§μ΄μΌνλ€.
**Additional context**
Add any other context or screenshots about the feature request here.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.