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

[ feat ] Header 컴포넌트 구현 #14

Merged
merged 13 commits into from
Jul 11, 2022
118 changes: 115 additions & 3 deletions components/common/Header.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,127 @@
import styled from '@emotion/styled';
import { useRouter } from 'next/router';
import { IcNoriHeaderLogo, IcSearchIcon } from '../../public/assets/icons';

export default function Header() {
return <StHeaderWrapper></StHeaderWrapper>;
const router = useRouter();

return (
<StHeaderWrapper>
<StTopLink>
<p>
<a>고객센터</a> | <a>마이페이지</a> | <a>로그인</a>
</p>
</StTopLink>
<StHeaderContents>
<IcNoriHeaderLogo type="button" onClick={() => router.push('/')} />
Copy link
Collaborator

Choose a reason for hiding this comment

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

Svg에도 타입을 지정해줘야 하나,,,?!!

Copy link
Member Author

Choose a reason for hiding this comment

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

음 일단은 버튼 기능을 해서 지정은 해 뒀는데 굳이 할 필요 없으려나??

<StSearchWrapper>
<StSearchBar>
<input placeholder="상품명, 스토어명을 검색해보세요!" />
Copy link
Contributor

Choose a reason for hiding this comment

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

input type도 적어주면 좋을 것 같아용

<IcSearchIcon />
</StSearchBar>
<StMenu>
<StMenuBtn type="button" onClick={() => router.push('/toyView')}>
상품보기
</StMenuBtn>
<StMenuBtn type="button" onClick={() => router.push('/community')}>
Copy link
Contributor

Choose a reason for hiding this comment

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

#1 이슈보면 하단 리뷰에
링크 이동은 next js 에서 제공하는 Link 태그가 더 SEO에 최적화된다고 알고 있습니다 !!
라는 리뷰가 있어요! 그래서, 새탭열지 않고 우리 페이지들 중에서 링크 전환하는 거면 Link태그 사용하면 좋을 것 같습니다!

Copy link
Member Author

Choose a reason for hiding this comment

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

아아 맞다맞다 바로 수정할게유

커뮤니티
</StMenuBtn>
<StMenuBtn>ABOUT</StMenuBtn>
</StMenu>
</StSearchWrapper>
</StHeaderContents>
</StHeaderWrapper>
);
}

const StHeaderWrapper = styled.header`
position: sticky;
padding-top: 32px;
top: -32px;
top: -3.2rem;

width: 100%;
height: 11.4rem;

background-color: #31cc94;
color: #ffffff;
`;

Copy link
Contributor

Choose a reason for hiding this comment

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

우리 컨벤션에서 스타일드 컴포넌트 사이에는 띄어쓰기 안 하는걸로 했어용!

Copy link
Member Author

Choose a reason for hiding this comment

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

확인! 바로 수정할게!!

const StTopLink = styled.div`
display: flex;
align-items: center;

padding: 0rem;
padding-top: 0.7rem;
padding-left: 75%;

font-style: normal;
font-weight: 400;
font-size: 1.2rem;
line-height: 1.6rem;
`;

const StHeaderContents = styled.section`
display: flex;
justify-content: space-around;
align-items: center;

width: 100%;
margin-top: 2.9rem;
`;

const StSearchWrapper = styled.div`
display: flex;
align-items: center;

gap: 4.8rem;
`;

const StSearchBar = styled.div`
display: flex;
justify-content: space-evenly;
align-items: center;

width: 28.5rem;
height: 4.2rem;

background: rgba(255, 255, 255, 0.14);
border-radius: 0.8rem;

input {
height: 2.2rem;
width: 22rem;

color: rgba(255, 255, 255, 0.75);
font-family: 'Pretendard';
font-style: normal;
font-weight: 500;
font-size: 1.6rem;
line-height: 140%;

&::placeholder {
color: rgba(255, 255, 255, 0.75);
}

:focus::placeholder {
opacity: 0;
}
}
`;

const StMenu = styled.div`
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;

width: 27.3rem;
height: 2.6rem;
gap: 3.2rem;

line-height: 2.6rem;
`;

const StMenuBtn = styled.button`
color: #ffffff;
font-weight: 500;
font-size: 1.8rem;
`;
3 changes: 2 additions & 1 deletion public/assets/icons/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export { default as IcNoriLogo } from './noriLogoIcon.svg';
export { default as IcNoriHeaderLogo } from './noriHeaderIcon.svg';
export {default as IcSearchIcon } from './searchIcon.svg';
11 changes: 11 additions & 0 deletions public/assets/icons/noriHeaderIcon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions public/assets/icons/searchIcon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.