Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
Tags
- 코딩부트캠프
- 프론트개발
- 프론트개발공부
- 리트코드
- [파이썬 실습] 심화 문제
- 자바스크립트 reduce()
- JavaScript
- 자바스크립트 sort()
- 개발공부
- leetcode
- HTML
- reactnativecli
- 자바스크립트 날씨
- RN 프로젝트
- [파이썬 실습] 중급 문제
- 엘리스 AI 트랙 5기
- 엘리스 ai 트랙
- 날씨 웹 만들기
- 삼항연산자
- [파이썬 실습] 기초 문제
- 코드스테이츠
- 부트캠프
- 프로그래머스
- 엘리스
- 자바스크립트
- 자바스크립트 날씨 웹 만들기
- [AI 5기] 연습 문제집
- 간단한 날씨 웹 만들기
- 개발일기
- 자바스크립트 split()
Archives
- Today
- Total
개발조각
[모두의 이력서_9일차] 헤더, 푸터 ui 구현(+ 반응형) 본문
728x90
반응형
단순하게 css만 짠거라 변경사항 코드만 붙이겠습니다.
styles > gloval.ts
import { createGlobalStyle } from "styled-components";
import { reset } from "styled-reset";
const Global = createGlobalStyle`
${reset}
*{
box-sizing: border-box;
outline: none;
}
html, input, select, textarea{
letter-spacing: -0.05em;
color: ${({ theme }) => theme.colors.blackText};
}
a{
text-decoration: none;
color: ${({ theme }) => theme.colors.blackText};
}
`;
export default Global;
- a태그 text-decoration 변경 및 글씨 색 검정으로 변경 (a태그 reset)
styles > common > css.ts
import { css } from "styled-components";
export const inner = css`
padding: 0 24px;
`;
- 이번에는 inner의 width값을 따로 지정을 안하고 좌우에 패딩을 주고 작업했습니다.
헤더
tsx
components > layout > header > Header.tsx
import Image from "next/image";
import Link from "next/link";
import Nav from "./Nav";
import User from "./User";
import * as styled from "../../../styles/components/layout/header/Header";
import logo from "../../../public/logo.svg";
const Header = () => {
return (
<styled.HeaderCon>
<styled.TopCon>
<h1>
<Link href="/">
<Image src={logo} alt="모두의 이력서 로고" />
</Link>
</h1>
<User device={"mobile"} />
</styled.TopCon>
<styled.RightCon>
<Nav />
<User device={"pc"} />
</styled.RightCon>
</styled.HeaderCon>
);
};
export default Header;
components > layout > header > Nav.tsx
import Link from "next/link";
import { useRouter } from "next/router";
import * as styled from "../../../styles/components/layout/header/Nav";
const Nav = () => {
const router = useRouter();
return (
<styled.NavCon>
<ul>
<styled.Navli pathname={router.pathname === "/"}>
<Link href="/">발견</Link>
</styled.Navli>
<styled.Navli pathname={router.pathname === "/Resume"}>
<Link href="/Resume">이력서</Link>
</styled.Navli>
</ul>
</styled.NavCon>
);
};
export default Nav;
components > layout > header > User.tsx
import Link from "next/link";
import * as Styled from "../../../styles/components/layout/header/User";
interface Props {
device: string;
}
const User = ({ device }: Props) => {
console.log(device);
return (
<Styled.UserList device={device}>
<li>
<Link href="/Login">로그인</Link>
</li>
<li>
<Link href="/Register">회원가입</Link>
</li>
</Styled.UserList>
);
};
export default User;
스타일
styles > components > layout > header > Header.ts
import styled from "styled-components";
import { inner } from "../../../common/css";
export const HeaderCon = styled.header`
display: flex;
align-items: center;
gap: 40px;
position: sticky;
top: 0;
left: 0;
${inner}
border-bottom: 1px solid ${({ theme }) => theme.colors.grayBd};
background: #fff;
${({ theme }) => theme.device.mobile} {
display: block;
h1 {
padding: 16px 0;
img {
width: auto;
height: 18px;
}
}
}
`;
export const TopCon = styled.div`
${({ theme }) => theme.device.mobile} {
${({ theme }) => theme.common.flexBetween}
}
`;
export const RightCon = styled.div`
${({ theme }) => theme.common.flexBetween}
width: 100%;
`;
styles > components > layout > header > Nav.ts
import styled from "styled-components";
export const NavCon = styled.nav`
ul {
display: flex;
gap: 32px;
font-weight: 500;
}
`;
export const Navli = styled.li<{ pathname: boolean }>`
position: relative;
padding: 20px 0;
&:after {
content: "";
${({ theme }) => theme.common.positionXCenter}
top: inherit;
bottom: 0;
width: 24px;
height: 4px;
background: ${({ pathname, theme }) =>
pathname ? theme.colors.blackText : "transparent"};
}
a {
transition: all 0.3s;
&:hover {
color: ${({ theme }) => theme.colors.grayText};
}
}
${({ theme }) => theme.device.mobile} {
padding: 16px 0;
}
`;
styles > components > layout > header > User.ts
import styled from "styled-components";
export const UserList = styled.ul<{ device: string }>`
display: ${({ device }) => (device === "pc" ? "flex" : "none")};
li {
padding: 0 8px;
font-weight: 300;
font-size: ${({ theme }) => theme.fontSizes.small};
}
li:nth-of-type(2n) {
border-left: 1px solid ${({ theme }) => theme.colors.grayBd};
}
a {
transition: all 0.3s;
&:hover {
color: ${({ theme }) => theme.colors.main};
}
}
${({ theme }) => theme.device.mobile} {
display: ${({ device }) => (device === "pc" ? "none" : "flex")};
}
`;
푸터
tsx
components > layout > Footer.tsx
import Image from "next/image";
import * as styled from "../../styles/components/layout/Footer";
import logo from "../../public/logo.svg";
const Footer = () => {
return (
<styled.FooterCon>
<styled.TopCon>
<h1>
<Image src={logo} alt="모두의 이력서 로고" />
</h1>
<styled.ListWrap>
<li>이용약관</li>
<li>개인정보 처리방침</li>
</styled.ListWrap>
</styled.TopCon>
<styled.BottomCon>
<p>© 2023. modooResume all rights reserved.</p>
</styled.BottomCon>
</styled.FooterCon>
);
};
export default Footer;
스타일
styles > components > layout > Footer.ts
import styled from "styled-components";
import { inner } from "../../common/css";
export const FooterCon = styled.footer`
border-top: 1px solid ${({ theme }) => theme.colors.grayBd};
background: #fff;
`;
export const TopCon = styled.div`
display: flex;
align-items: center;
gap: 40px;
height: 48px;
${inner}
h1 {
img {
width: auto;
height: 16px;
}
}
${({ theme }) => theme.device.mobile} {
display: block;
height: auto;
padding-top: 24px;
h1 {
text-align: center;
}
}
`;
export const ListWrap = styled.ul`
display: flex;
gap: 44px;
li:last-of-type {
font-weight: 500;
}
${({ theme }) => theme.device.mobile} {
${({ theme }) => theme.common.flexCenter}
margin-top: 32px;
}
`;
export const BottomCon = styled.div`
border-top: 1px solid ${({ theme }) => theme.colors.grayBd};
padding: 24px;
padding-bottom: 80px;
p {
font-weight: 300;
font-size: ${({ theme }) => theme.fontSizes.small};
color: ${({ theme }) => theme.colors.grayText};
}
${({ theme }) => theme.device.mobile} {
padding: 40px 24px 80px 24px;
border-top: 0;
text-align: center;
}
`;
구현 화면
PC
Mobile
728x90
반응형
'모두의 이력서' 카테고리의 다른 글
[모두의 이력서_12일차] Next url표시 방법, Next 특정 페이지에서 header안보이게 하기 (0) | 2023.04.06 |
---|---|
[모두의 이력서_10-11일차] 다크모드(React Context API + Next.js + TS + styled-component) (0) | 2023.04.05 |
[모두의 이력서_9일차] Next.js 이미지 넣기, Next.js에서 현재 url을 알고 싶을 때 (0) | 2023.04.03 |
[모두의 이력서_8일차] Next.js 파비콘 적용 + 구글폰트 적용하기 (0) | 2023.04.03 |
[모두의 이력서_7일차] styled-components + Next.js + TS (0) | 2023.03.31 |
Comments