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

[Fix] useDevice hook 확장 #391

Merged
merged 4 commits into from
Aug 13, 2024
Merged

[Fix] useDevice hook 확장 #391

merged 4 commits into from
Aug 13, 2024

Conversation

lydiacho
Copy link
Member

Related Issue : Closes #390


🧑‍🎤 Summary

  • breakPoint가 428/429 에서 430/431 로 바뀌어서 반영해줬어요
  • useDevice에 breakPoint 주입할 수 있도록 prop 뚫어줬어요

🧑‍🎤 Comment

Footer 같은 경우, 특수하게 breakPoint 가 혼자 달라요.
이런 케이스가 앞으로도 생길 수 있기 때문에 tablet breakPoint, mobile breakPoint 주입해줄 수 있도록,
대신 기존에 사용된 훅들에 영향 없도록 optional prop 추가해주었습니다

@lydiacho lydiacho self-assigned this Aug 13, 2024
Copy link

height bot commented Aug 13, 2024

Link Height tasks by mentioning a task ID in the pull request title or commit messages, or description and comments with the keyword link (e.g. "Link T-123").

💡Tip: You can also use "Close T-X" to automatically close a task when the pull request is merged.

Comment on lines 26 to 28
export function useDevice(tabPoint?: string, mobPoint?: string): 'TAB' | 'MOB' | 'DESK' {
const isTablet = useIsTablet(tabPoint);
const isMobile = useIsMobile(mobPoint);
Copy link
Member

@eonseok-jeon eonseok-jeon Aug 13, 2024

Choose a reason for hiding this comment

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

useIsTablet에 들어가는 tabPoint는 tabel 기준 minWidth가 될 것이고
useIsMobie에 들어가는 mobPoint는 mobile 기준 maxWidth가 되니까
결국 tabPoint와 mobPoint가 같은 거 아닌가요??
모바일 기준 최대 너비가 태블릿 기준 최소 너비니까요!

useIsTablet에서 minWidth의 default value가 431이고, useIsMobile에서 maxWidth의 default value가 430.999 이지만
브라우저에서 px 소수점 인식 제대로 못하기 때문에 하나의 변수로 통일 시켜도 될 거 같다는 생각입니다!

Copy link
Member Author

@lydiacho lydiacho Aug 13, 2024

Choose a reason for hiding this comment

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

아 제가 prop을 잘못 작성했는데,
제가 의도했던 코드는 이거였어요!!
저희가 breakPoint가 두개니까요.

+) 그리고 breakPoint 두개를 일반 arguments로 주면 사용하는 쪽에서 어떤 순서로 작성해야 하는지 혼동할 수 있을 것 같아서
값 의미를 정확히 하고자 객체로 묶어서 주었어요

혹시 어떠신가요? ?

export function useDevice({ mobMax, tabMax }: { mobMax?: string; tabMax?: string }): 'TAB' | 'MOB' | 'DESK' {
  const isTablet = useIsTablet(mobMax, tabMax);
  const isMobile = useIsMobile(mobMax);

  return isTablet ? 'TAB' : isMobile ? 'MOB' : 'DESK';
}

Copy link
Member

Choose a reason for hiding this comment

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

너무 좋습니다~~~ :)
고생하셨어여 😄

@lydiacho lydiacho merged commit 8f903d8 into develop Aug 13, 2024
@lydiacho lydiacho deleted the fix/#390_use-device branch August 13, 2024 08:35
lydiacho added a commit that referenced this pull request Aug 13, 2024
* fix: breakPoint 수정

* fix: useDevice prop 추가

* fix: mobPoint, tabPoint 적용

* fix: useDevice prop 객체로 묶음
lydiacho added a commit that referenced this pull request Aug 14, 2024
* design: Input short/long 반응형 및 Select 일부 구현

* design: Footer 반응형 구현

* design: Select 반응형 구현

* fix: TextBox 반응형

* design: TextArea 반응형

* design: SelectBox 반응형

* design: Footer 반응형

* [Fix] useDevice hook 확장  (#391)

* fix: breakPoint 수정

* fix: useDevice prop 추가

* fix: mobPoint, tabPoint 적용

* fix: useDevice prop 객체로 묶음

* fix: useDevice 기본인수 추가 및 Footer mobMax 설정

* fix: deviceType context로 전달

* chore: import build error fix

* fix: DEVICE_TYPE -> deviceType 네이밍 변경
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Fix] useDevice breakPoint 설정 가능하도록 수정
2 participants