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

Feature/fe-057 : mobile 대응 먹팟 등록페이지 css 수정 #83

Merged
merged 8 commits into from
Jul 9, 2023

Conversation

naro-Kim
Copy link
Contributor

@naro-Kim naro-Kim commented Jul 4, 2023

[FE] 게시글 등록 페이지 모바일 버전

체크 리스트

  • 적절한 제목으로 수정했나요?
  • 관련된 이슈와 연결 시켰나요?
  • Target Branch를 올바르게 설정했나요?
  • Label을 알맞게 설정했나요?

작업 내역

screen1
screen2

  • Input section media-query 적용
  • useMediaQuery 공통 훅 생성

문제 상황과 해결

  • 791px 사이즈부터 대응되는 디자인에 맞춰 먹팟 등록 페이지의 전체적인 css를 수정했습니다.
  • write 페이지를 전체적으로 수정하면서 schema의 유효성 검사 텍스트도 함께 수정했습니다.
  • breakPoint를 사용한 Media Query와 별개로, 모바일뷰에서 바뀌는 컴포넌트 순서에 대응하기 위해 아래와 같이 사용할 수 있는 useMediaQuery 훅을 만들었습니다.
import { useMediaQuery } from '@/hooks';
...
const mobile = useMediaQuery({bp:'m'});
  • useMediaQuery훅은 bp를 props로 받으며 bp는 theme.css.ts breakPoints 객체의 키에 해당합니다. 현재는 's'(360px)와 'm'(791px)이 사용 가능합니다.

비고

@naro-Kim naro-Kim added the ✨ feature new feature label Jul 4, 2023
@naro-Kim naro-Kim self-assigned this Jul 4, 2023
Comment on lines 28 to 32
const [isMobile, setMobile] = useState<boolean>(false);
const mobile = useMediaQuery();
useEffect(() => {
setMobile(mobile);
}, [mobile]);
Copy link
Member

Choose a reason for hiding this comment

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

useMediaQuery를 통해서 이미 모바일인지 아닌지를 알고있는 상태가 있으니 추가적으로 useState, useEffect를 선언할 필요는 없어보여요!

Copy link
Contributor Author

@naro-Kim naro-Kim Jul 4, 2023

Choose a reason for hiding this comment

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

스크린샷 2023-07-04 오후 11 28 27

이 부분과 관련해서 참고 사항에 링크 달아뒀는데, state를 사용하지 않을 경우 위와 같이 Hydrate에러가 발생합니다!
state없이도 로컬에서 잘 작동하지만 혹시 몰라서 state로 에러를 해결해뒀는데 state를 사용하는 것과 사용하지 않는 것 둘 중에 어떤 방법이 좋을까요 ..?

Copy link
Member

Choose a reason for hiding this comment

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

useEffect 사용은 서버사이드 환경에서는 어쩔수 없어 보이네요..! useMediaQuery, useState, useEffect 부분을 하나의 훅으로 묶어서 공통 훅으로 만들어주시면 좋을듯합니다!

<div></div>
<Typography variant="body3" as="p" color="secondary">
베타서비스에서는 채팅 기능이 제공되지 않습니다. <br /> 효율적인 소통을 위해 오픈 채팅방을 만들어주세요.
</Typography>
</InputSection>
<Button size="xLarge" type="submit" disabled={!method.formState.isDirty}>
<Button style={{ width: '100%' }} type="submit" disabled={!method.formState.isDirty}>
Copy link
Contributor

Choose a reason for hiding this comment

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

Button 컴포넌트 모바일인 케이스에서 "100%" 이게 수정 했는데, 그것때문에 추가하신 건가요?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

오 맞아요.. writing page의 버튼들은 부모에서 width를 받는 동시에, writing page에서 모바일 첫 스텝은 Button 위에 margin이 추가되는 반면 두번째 스텝은 마진이 추가되질 않아서 첫 스텝의 버튼은 className으로 스타일링 하고 두번째 스텝의 버튼은 width만 인라인으로 주었었습니다..!

제가 paddingSmall하고 medium이 추가된 걸 놓치고 있었네요 ! 수정해보겠습니다

@@ -1,8 +1,12 @@
import { useState, useEffect } from 'react';
import { breakPoints } from '@/styles/theme.css';
import { breakPoints, BreakPoints } from '@/styles/theme.css';
Copy link
Contributor

Choose a reason for hiding this comment

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

BreakPoints theme.css에 안보이는데 ..! 제가 잘못본걸까요?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

아 이거 타입으로 만들어서 테스트했던 코드였는데 제가 깜빡하고 수정안했던거네요! 수정해서 commit하겠습니다 감사합니당

@sonarcloud
Copy link

sonarcloud bot commented Jul 8, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 4 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

Copy link
Contributor

@jieunpark247 jieunpark247 left a comment

Choose a reason for hiding this comment

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

수고하셨습니다~ 👍🏼

@naro-Kim naro-Kim merged commit 79a088d into dev Jul 9, 2023
3 checks passed
@naro-Kim naro-Kim deleted the feature/FE-057 branch July 9, 2023 07:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✨ feature new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants