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

[FE 박준혁 / 윤동현] - 옵션 선택 페이지 360도 회전 구현 #28

Open
wants to merge 2 commits into
base: dgfh0450_jpark0506
Choose a base branch
from

Conversation

jpark0506
Copy link

주요 작업

  • 옵션 선택 페이지의 360도 회전을 구현

학습 키워드

고민과 해결과정

<button className="mr-3 text-[#002C5f] font-medium after:inline-block after:w-[8px] after:h-[8px] after:ml-[6px] after:mt-[6px] after:border-b-2 after:border-r-2 after:border-[#002C5f] after:rotate-[-45deg] after:-translate-x-[2px] after:-translate-y-[2px]">
                모델 변경
</button>

tailwind css 사용할 때 after나 before을 사용하면 코드가 많이 난잡해진다는 것을 느꼈다.

dgfh0450 and others added 2 commits January 22, 2025 18:43
* feature : change backend data structure / frontend apply animation of preview

* feature : Apply Custom Car Option Section
return;
}

const api = new API();
Copy link
Contributor

Choose a reason for hiding this comment

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

API클래스(?)가 생성자가 없다면 클래스 말고 객체리터럴로 만들어서 활용해보세요.

colors,
options,
preview
}: { colors: Tcolors, options: Toptions, preview: string } = await api.get('/api/car/models/options', {
Copy link
Contributor

Choose a reason for hiding this comment

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

{ colors: Tcolors, options: Toptions, preview: string }
이건 타입이나 인터페이스 미리 만들어서 사용~
그러면 여기 코드가 간편해질듯.

get은 만든것이면 generic으로 만드는것도 방법.

async function get<T>(url: string): Promise<T> {

그리고 호출할때는 이런식으로

 await api.get<CarModelOptions>('/car/models/options');

options: options
})
setPreview(preview);
setLoading(true);
Copy link
Contributor

Choose a reason for hiding this comment

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

loading처리가 좀 번잡해지죠.
이를때 useFetch 훅같은거 만들어서 사용하곤 합니다.
아니면 react-query를 쓰면 이부분 지원도 되기도 할거 같고요.

@crongro
Copy link
Contributor

crongro commented Jan 24, 2025

이거 충돌났따 ~ @jpark0506

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants