-
Notifications
You must be signed in to change notification settings - Fork 78
[이승헌] sprint10 #660
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
base: Next.js-이승헌
Are you sure you want to change the base?
The head ref may contain hidden characters: "Next.js-\uC774\uC2B9\uD5CC-sprint10"
[이승헌] sprint10 #660
Conversation
- import 순서 자동 정렬 - tailwindcss 클래스 순서 자동 정렬 - import alias 설정: api, hooks, components, utils
- prop 값에 따라 다른 스타일 구현
- 화면 사이즈에 따라 판다마켓 로고 이미지 다르게 표시 - 현재 주소에 해당하는 네비게이션 메뉴 파랗게 표시
- Layout 컴포넌트 구현 - App에 Layout 적용
- axios 설치 - apis 폴더 alias 설정 - apis import 자동 정렬 적용 - base url 설정
- path가 /boards, /boards/숫자, /addboard 일 때 자유게시판 표시 - path가 /products, /products/숫자 일 때 중고마켓 표시
- main 태그를 레이아웃으로 옮겨서 div 태그 사용 줄임 - 홈페이지, 로그인/회원가입 페이지, 그 외 페이지 각각 다른 레이아웃 적용 - 로그인/회원가입 페이지 레이아웃 UI 구현
- 기존 Header 컴포넌트는 MainHeader로 이름 수정 - 로그인/회원가입의 헤더는 LogoHeader라는 이름의 컴포넌트로 분리 - 둘 다 헤더이기 때문에 둘 다 같은 레벨인 컴포넌트로 만듦
- 기존 룰로는 types 폴더 안 파일들에게 alias를 적용할 수 없음 - 룰 변경: @ => @/ - import order에 types 폴더도 추가
@@ -0,0 +1,7 @@ | |||
import axios from 'axios'; | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
axios.defaults.baseURL = "https://panda";
axios.defaults.headers.common['Content-Type'] = "application/json";
axios.defaults.timeout = 5000;
const instance = axios.create();
// [Client] ------ [interceptor] --------> [Server]
instance.interceptors.request.use( req => { }, err => { } );
// [Client] <------ [interceptor] -------- [Server]
instance.interceptors.response.use( res => { }, erro => { } );
onClick: MouseEventHandler<HTMLButtonElement>; | ||
children: ReactNode; | ||
}; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Button
, Input
같이 최소 단위 컴포넌트 같은 경우, 보통 forwardRef 적용을 많이 합니다.
이유는 해당 tag의 native 이벤트(클릭, 포커스, 블러 등)를 컴포넌트 외부에서도 조정할 수 있게 끔 하기 위해서입니다.
interface ButtonProps extends PropsWithChildren {};
const Button = forwardRef<HTMLButtonElement, ButtonProps>( (props, ref) => {
const {children} = props;
return (
<button ref={ref}>{children}</button>
)
})
// ./page or ./component
const DummyComponent= () => {
const buttonRef = useRef<HTMLButtonElement>(null);
const hanldeClickTrigger = () => {
buttonRef.current?.click();
}
return (
<>
<Button ref={buttonRef} onClick={() => console.log("cliced by trigger-button")} />
<button onClick={hanldeClickTrigger}>trigger-button</button>
<>
)
}
요구사항
스프린트 미션 10 Figma 디자인 확인하러 바로가기
기본
게시글 등록 페이지
게시글 상세 페이지
주요 변경사항
스크린샷
🚀 배포 페이지: heony704-pandamarket-10.netlify.app/boards/11
게시글 상세 페이지
멘토에게