[TIL] 내배캠4기-React-54일차

hare·2022년 12월 23일
0

내배캠-TIL

목록 보기
40/75

px to rem

푸시하고 나서 받은 피드백 중에 px를 rem으로 바꿔달라는 것이 있었다.
왜 굳이? 라는 생각이 들어서 찾아보니
https://yozm.wishket.com/magazine/detail/1410/
px로 값을 고정하는 순간 브라우저의 설정을 무시하게 된다고 한다.
그저 단위의 차이만 존재하는 줄 알았는데 이런 특징이 있었다니!

vscode 플러그인
px to rem & rpx & vw (cssrem)

 const StyledCategory = styled.p`
  margin-left: 10px;
  margin-top: 27px;
  margin-bottom: 0px;
  width: fit-content;
  height: 23px;
  font-style: normal;
  font-weight: 700;
  font-size: 16px;
  line-height: 23px;
`;

수정전

.category {
    margin-left: 0.75rem;
    margin-top: 1.75rem;
    margin-bottom: 0rem;
    width: fit-content;
    height: 1.5rem;
    font-style: normal;
    font-weight: 700;
    font-size: 1rem;
    line-height: 1.5rem;
  }

수정후

잘보면 스타일드컴포넌트로 만들었는데 SCSS로 수정했다.
굳이 하나하나 SC로 만들어줄 이유가 없었는데 이렇게 하니 가독성이 좋아졌다.

팀원들의 피드백을 받고 몰랐던 부분을 알아가게 되어 좋다 ☺️

profile
해뜰날

0개의 댓글