React로 1페이지 자기소개 페이지를 만들었던 과정이다.

패키지 관리자는 Yarn을 사용했다.

 

선행 과정

- Source Tree로 원격/로컬 Repository 만들기  

- VsCode extention으로 Prettier - code formatter, ESLint, Prettier ESLint  설치 및 적용

- Create React App  

프로젝트 코드 

코드 작성

텍스트만 적었다. 반응형 작업만 적용하고 불필요한 시각적 효과는 주지 않았다.

우선 각 파트를 컴포넌트로 나누어 작업했다.

props 전달은 하지 않았다.

 

컴포넌트 분리

컴포넌트를 포함한 item 디렉토리

위 사진에서처럼 컴포넌트로 분리했다.

 

src/item/index.ts

import Greetings from './Greetings';
import ExperienceTitle from './ExperienceTitle';
import OtherExperience from './OtherExperience';
import WorkExperience from './WorkExperience';
import Skills from './Skills';
import Contact from './Contact';
export { Greetings, OtherExperience, ExperienceTitle, WorkExperience, Skills, Contact };

item/index.ts 코드이다. App.tsx에서 위 코드에 명시된 컴포넌트를 import할 때 src/item 에서 불러오면 된다.

 

CSS적용

h1 {
  font-size: 4rem;
  line-height: 1.1;
}

h2 {
  font-size: 3rem;
  margin: 4rem 0 2rem;
}

h3,
h4 {
  font-size: 2rem;
  margin: 0 0 1rem;
}

h5 {
  font-size: 1.3rem;
  margin: 0 0 0.5rem;
}

p {
  margin: 0 0 1.5rem;
  font-size: 1.1rem;
  line-height: 1.4rem;
}

ul {
  list-style: none;
  padding: 0;
  margin: 0 0 1rem;
  font-size: 1.1rem;
}

ul > li:before {
  padding-right: 0.5rem;
  display: inline-block;
  content: '•';
}

a {
  text-decoration: none;
}

.App {
  display: flex;
  flex-direction: column;
  align-items: center;
  align-self: center;

  background-color: #b5d692;
}

.container {
  padding: 40px 0px;
}

.big-p {
  font-size: 2rem;
  line-height: 1.4;
  font-weight: 500;
}

.time {
  display: block;
  margin-bottom: 1.5rem;
}

.role {
  margin-bottom: 0.3rem;
  display: block;
}

.row {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  padding: 3rem 0;
}

.row-left {
  -ms-flex-preferred-size: 18rem;
  flex-basis: 18rem;
  padding-right: 1rem;
  -ms-flex-negative: 0;
  flex-shrink: 0;
}

.row-right {
  -webkit-box-flex: 1;
  -ms-flex-positive: 1;
  flex-grow: 1;
  flex-direction: column;
}

.project {
  padding: 1.5rem 0;
}

.project:first-child {
  padding-top: 0;
}

.other {
  padding: 3rem 0;
}

@media (max-width: 768px) {
  .container {
    width: 90%;
  }
}

@media (min-width: 769px) and (max-width: 1024px) {
  .container {
    width: 80%;
  }
}

@media (min-width: 1025px) and (max-width: 1527px) {
  .container {
    width: 70%;
  }
}

@media (min-width: 1528px) {
  .container {
    width: 50%;
  }
}

@media (max-width: 960px) {
  .row {
    flex-direction: column;
  }
}

위와 같이 적용했다. 태그 선택자 및 클래스 선택자 별로 스타일을 적용해줬다. media-query를 통해 간단한 반응형 적용을 했다.  

styled-components는 적용하지 않았다.

 

 

 

+ Recent posts