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

assignment: 한슬희 #1

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,7 @@
2022년도 개발자들 FE - 리액트 03

> 6주차 과제 repo

## Result

![ezgif com-gif-maker (4)](https://user-images.githubusercontent.com/63100352/170821552-5fc38705-3830-4a3f-a53c-4e31a703bcbd.gif)
25,224 changes: 25,224 additions & 0 deletions package-lock.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"version": "0.1.0",
"private": true,
"dependencies": {
"@emotion/react": "^11.9.0",
"@testing-library/jest-dom": "^5.14.1",
"@testing-library/react": "^13.0.0",
"@testing-library/user-event": "^13.2.1",
Expand Down
2 changes: 1 addition & 1 deletion public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
-->
<title>React App</title>
</head>
<body>
<body style="margin: 0">
Copy link
Contributor

Choose a reason for hiding this comment

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

과제라서 이렇게 하셨겠지만, 이런 경우 emotion global style로 처리하시는게 좋을 거 가타용

<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<!--
Expand Down
106 changes: 105 additions & 1 deletion src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,113 @@
/** @jsxImportSource @emotion/react */
import { css } from "@emotion/react";
import Card from "./components/Card";
import Inform from "./components/Inform";
import Nav from "./components/Nav";
import profile from "./image/profile.jpg";
import Comment from "./components/Comment";

function App() {
return (
<div>
Copy link
Contributor

Choose a reason for hiding this comment

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

시맨틱 태그에 대해서 공부해보고 적용해보시면 좋을 거 같아용 👍

<h1>Hello world 03</h1>
<Nav />
<section css={contentWrapper}>
<div css={inWrapper}>
<h1 css={title}>한슬희 | dogvelopers</h1>
<div css={informWrapper}>
<div css={imgSize}>
<img src={profile} css={profileImg} alt="profile" />
</div>
<div css={informWrapperSort}>
<Inform title="🎁 Date of birth" summary="2001.03.26" />
<Inform title="✍🏻 Student ID" summary="202014135" />
<Inform title="✉️ E-mail" summary="[email protected]" />
Comment on lines +21 to +23
Copy link
Member

Choose a reason for hiding this comment

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

이모티콘 활용을 정말 잘 하시는 것 같아요!
그리고 Inform 컴포넌트에서 가져와서 사용하시는 모습을 보고 깔끔하게 코딩을 잘 하시는 것 같아요..!

</div>
</div>
<div css={introduceSort}>
<h2>🙋🏻‍♀️ Introduce</h2>
<span css={summary}>
• 소프트웨어 공학과에 재학중인 한슬희입니다.
</span>
<span css={summary}>• 🍔햄버거와 🎞️영화를 좋아합니다. 😊</span>
</div>
<h2>🎈 Experience</h2>
<div css={expreienceWrapper}>
<Card />
<div css={commentWrapper}>
<Comment />
</div>
</div>
</div>
</section>
</div>
);
}

export default App;

const title = css`
font-size: 2.7rem;
`;

const inWrapper = css`
max-width: 100%;
display: flex;
flex-direction: column;
line-height: 1.5;
`;

const contentWrapper = css`
position: relative;
width: 100%;
margin: 4rem 0;
display: flex;
flex-direction: column;
align-items: center;
`;

const informWrapper = css`
display: flex;
flex-direction: row;
align-items: center;
margin-top: 2rem;
`;

const informWrapperSort = css`
display: flex;
flex-direction: column;
margin-left: 8rem;
height: auto;
`;

const imgSize = css`
width: 17rem;
height: 17rem;
border-radius: 70%;
overflow: hidden;
`;

const profileImg = css`
width: 100%;
height: 100%;
object-fit: cover;
`;

const introduceSort = css`
display: flex;
flex-direction: column;
margin: 3.7rem 7rem 3rem 0;
`;

const summary = css`
font-size: 1rem;
font-weight: 300;
`;

const expreienceWrapper = css`
display: flex;
flex-direction: row;
`;

const commentWrapper = css`
margin-left: 2rem;
`;
69 changes: 69 additions & 0 deletions src/components/Card.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
/** @jsxImportSource @emotion/react */

import { css } from "@emotion/react";
import dogvelopers from "../image/dogvelopers.png";

function Card() {
return (
<div css={cardSizeWrapper}>
<div css={imgSizeWrapper}>
<img src={dogvelopers} css={cardImg} alt="img" />
</div>
<div css={summaryWrapper}>
<span css={activityName}>🐶 개발자들</span>
<div css={category}>동아리</div>
<span css={organization}>성공회대학교</span>
<span>2022/03/02 ~ </span>
</div>
</div>
);
}

export default Card;

const cardSizeWrapper = css`
display: flex;
justify-content: center;
height: 13.4rem;
padding-right: 4rem;
box-shadow: 0px 0px 3px 0px rgb(213, 213, 213);
cursor: pointer;
`;

const imgSizeWrapper = css`
width: 200px;
height: 200px;
`;
const cardImg = css`
width: 100%;
height: 100%;
`;

const summaryWrapper = css`
display: flex;
flex-direction: column;
font-weight: 300;
font-size: 1rem;
`;

const activityName = css`
font-size: 1.1rem;
margin: 0.6rem 0;
`;

const category = css`
display: flex;
justify-content: center;
align-items: center;
border-radius: 4px;
width: fit-content;
Copy link
Member

Choose a reason for hiding this comment

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

fit-content로 width 속성값을 설정하는 것을 아직 한 번도 사용을 해보지 않았는데,
슬희님 만드신 거 보면서 저도 꼭 사용을 해봐야겠다는 생각이 들었습니다!

height: auto;
padding: 0.05rem;
font-size: 0.8rem;
background-color: #eee0da;
margin: 0.6rem 0;
`;

const organization = css`
margin-bottom: 0.2rem;
`;
81 changes: 81 additions & 0 deletions src/components/Comment.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
/** @jsxImportSource @emotion/react */

import { css } from "@emotion/react";
import { ChangeEvent, FormEvent, useState } from "react";

interface IComment {
name: string;
summary: string;
}

function Comment() {
const [comments, setComments] = useState<IComment[]>([]);
const [messageState, setMessageState] = useState("댓글이 아직 없어요");
const [nameState, setNameState] = useState<string>("");
const [summaryState, setSummaryState] = useState<string>("");

function onSubmitForm(event: FormEvent<HTMLFormElement>) {
event.preventDefault();
setComments((prev) => [...prev, { name: nameState, summary: summaryState }])
setMessageState("댓글들")
setNameState("")
setSummaryState("");
}

function onNameInput(event: ChangeEvent<HTMLInputElement>) {
setNameState(event.target.value)
}

function onSummaryInput(event: ChangeEvent<HTMLInputElement>) {
setSummaryState(event.target.value);
}

return (
<div>
<span css={text}>{messageState}</span>
<form css={inputWrapper} onSubmit={onSubmitForm}>
<input placeholder="닉네임" css={eachInput} value={nameState} onChange={onNameInput} />
<input placeholder="내용" css={eachInput} value={summaryState} onChange={onSummaryInput} />
<button css={buttonWrapper}>확인</button>
</form>
<div css={commentSort}>
{comments.map((comment) => (
<span><b>{comment.name}</b>: {comment.summary}</span>
))}</div>
</div>
);
}

export default Comment;

const text = css`
font-size: 1.1rem;
font-weight: 700;
`;
Comment on lines +51 to +54
Copy link
Member

@NohWookJin NohWookJin Jun 19, 2022

Choose a reason for hiding this comment

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

emotion 사용이 나중에 관리할 때 더 쉬울 것 같다는 생각이 들었어요.
다음 번에 저도 꼭 사용해보겠습니다..😳


const inputWrapper = css`
margin: 0.6rem 0;
`

const eachInput = css`
all: unset;
border-bottom: 1px solid black;
font-size: 0.9rem;
font-weight: 300;
margin-right: 1rem;
`;

const buttonWrapper = css`
all: unset;
font-size: 0.8rem;
font-weight: 800;
cursor: pointer;
`;

const commentSort = css`
display: flex;
flex-direction: column;
height: 9rem;
overflow-y: auto;
margin: 0.7rem 0;
`
35 changes: 35 additions & 0 deletions src/components/Inform.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/** @jsxImportSource @emotion/react */

import { css } from "@emotion/react";

interface Props {
title: string;
summary: string;
}

function Inform({ title, summary }: Props) {
return (
<div css={columnSort}>
<span css={informCategory}>{title}</span>
<span css={inform}>{summary}</span>
</div>
);
}

export default Inform;

const columnSort = css`
display: flex;
flex-direction: column;
height: 5rem;
`;
const informCategory = css`
font-size: 1.1rem;
font-weight: 600;
margin-bottom: 0.9rem;
`;

const inform = css`
font-size: 1rem;
font-weight: 300;
`;
23 changes: 23 additions & 0 deletions src/components/Nav.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/** @jsxImportSource @emotion/react */

import { css } from "@emotion/react";

function Nav() {
return (
<nav css={navbar}>
<div css={logoSize}>
<span>👩🏻‍💻 한슬희 | dogvelopers</span>
</div>
</nav>
);
}

export default Nav;

const navbar = css`
padding: 0.8rem 1.1rem;
`;

const logoSize = css`
font-weight: 300;
`;
Binary file added src/image/dogvelopers.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/image/profile.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading