Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
eb919f3
feat: PostList 더미데이터 렌더링
solar3070 Nov 14, 2022
1136a51
chore: gitignore 추가
solar3070 Nov 14, 2022
869c953
feat: api 요청 함수 작성
solar3070 Nov 14, 2022
5e652b6
feat: Root Documents 가져오는 api 연결
solar3070 Nov 14, 2022
270651a
feat: PostsPage 생성
solar3070 Nov 14, 2022
1926a68
feat: App 컴포넌트 생성
solar3070 Nov 14, 2022
5ad629f
feat: 버튼 컴포넌트 추가
solar3070 Nov 14, 2022
71610c3
feat: PostsPage에 페이지 추가 버튼 생성
solar3070 Nov 14, 2022
47b7ffe
feat: Editor 컴포넌트 생성
solar3070 Nov 14, 2022
dc81dd1
feat: storage.js 생성
solar3070 Nov 14, 2022
b4219b6
feat: 편집 중 상태를 알리는 콜백 함수 생성
solar3070 Nov 14, 2022
3bb525a
feat: onEditing 콜백 함수 디바운싱 처리
solar3070 Nov 14, 2022
3773b11
feat: PostEditPage 생성
solar3070 Nov 14, 2022
c4770e1
chore: api 헤더 x-username 변경
solar3070 Nov 14, 2022
d1b8220
feat: 라우팅 처리
solar3070 Nov 14, 2022
f51d1de
feat: 임시저장 Confirm 띄우기
solar3070 Nov 14, 2022
98adb9b
feat: postId에 따른 api 처리
solar3070 Nov 14, 2022
f50b874
feat: router.js 생성
solar3070 Nov 14, 2022
8d6365a
feat: 이동 버튼들 추가
solar3070 Nov 14, 2022
2c21a36
design: 문서 리스트 옆에 에디터 창 위치
solar3070 Nov 15, 2022
dccbb2e
chore: 필요없는 버튼 제거
solar3070 Nov 15, 2022
2d97090
feat: 페이지 추가 버튼 클릭시 문서 바로 생성
solar3070 Nov 15, 2022
eac8759
feat: 문서 삭제 기능 구현
solar3070 Nov 15, 2022
6b014c9
feat: 하위 문서 생성 기능 구현
solar3070 Nov 15, 2022
55024bd
feat: 제목 수정시 문서 리스트에도 실시간 반영
solar3070 Nov 15, 2022
c2e0a8e
design: 노션 레이아웃 스타일링
solar3070 Nov 15, 2022
7e81611
feat: 뒤로 가기, 앞으로 가기 구현
solar3070 Nov 16, 2022
7f58224
feat: 특정 포스트에서 새로고침할 때 리스트도 같이 뜨도록 수정
solar3070 Nov 16, 2022
125fdab
feat: 포스트 재클릭시 내용 날아감 방지
solar3070 Nov 16, 2022
3626b12
fix: 깜빡임 현상 방지 위해 코드 복구
solar3070 Nov 16, 2022
d235f4f
feat: 문서 수정 낙관적 업데이트
solar3070 Nov 16, 2022
49a1129
feat: 문서 삭제시 루트 URL로 이동
solar3070 Nov 16, 2022
43c58c8
feat: 문서 삭제시 루트 URL 이동 방어 코드 추가
solar3070 Nov 16, 2022
0c848c3
feat: 페이지 추가 버튼 클릭시 문서 트리 갱신
solar3070 Nov 16, 2022
543653c
feat: 특정 포스트에서 새로고침시 문서 트리 로드
solar3070 Nov 16, 2022
4189852
refactor: api 호출 함수들 생성
solar3070 Nov 16, 2022
44b612e
feat: 문서 리스트 렌더링하는 함수 생성
solar3070 Nov 16, 2022
c06f7e3
feat: 현재 편집 중인 문서의 하위 문서 링크 렌더링
solar3070 Nov 16, 2022
d712485
fix: js파일 확장자 붙이기
solar3070 Nov 16, 2022
49c04ac
design: 간단한 스타일링
solar3070 Nov 16, 2022
99b073d
feat: 하위 페이지 토글 기능 구현
solar3070 Nov 17, 2022
486fc28
design: 클릭 문서 액티브 스타일링
solar3070 Nov 17, 2022
c979e6a
feat: 헤더와 파비콘 추가
solar3070 Nov 18, 2022
9d596b5
design: 문서 제목 글자 초과시 ... 처리
solar3070 Nov 18, 2022
720e580
chore: 컬러 코드 변수 파일로 빼기
solar3070 Nov 18, 2022
d1bb616
chore: 클래스 이름 수정
solar3070 Nov 18, 2022
a19d4b3
feat: 헤더 타이틀 클릭시 루트로 이동
solar3070 Nov 18, 2022
3c87f90
chore: netlify 배포 404 에러 해결
solar3070 Nov 18, 2022
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
100 changes: 99 additions & 1 deletion css/style.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion css/style.css.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

123 changes: 122 additions & 1 deletion css/style.scss
Original file line number Diff line number Diff line change
@@ -1,17 +1,138 @@
body {
margin: 0;

li {
list-style-type: none;
}

ul {
padding-left: 10px;
}
}

#app {
display: flex;
}

/* 사이드 바 */

.posts-page {
background-color: #f3f3e3;
width: 15rem;
height: 100vh;
margin-right: 50px;
padding: 10px;

font-size: 15px;
background-color: #f7f6f3;
}

.post {
display: flex;
justify-content: space-between;
align-items: center;

border-radius: 5px;
cursor: pointer;

&:hover {
background-color: #ebebea;

.button-group > button {
opacity: 1;
}
}
}

.button-group {
width: 50px;

& > button {
width: 20px;
height: 20px;
align-items: center;

background-color: #ebebea;
border: none;
border-radius: 5px;

font-size: 10px;
color: #676662;
line-height: 10px;
opacity: 0;

&:hover {
background-color: #dddddc;
cursor: pointer;
}
}
}

.toggle-button {
background: none;
border: none;
border-radius: 5px;
font-size: 20px;
cursor: pointer;

&:hover {

Choose a reason for hiding this comment

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

아 &를 이럴때 쓰는거네요..
저는 hover 효과 줄 때
.toggle-button:hover 이런식으로 하나를 또 만들었는데ㅋㅋㅋ 배워갑니당

background-color: #dddddc;
}
}

.page-create {
width: 100%;
padding: 10px;

text-align: left;
background: none;
border: none;
border-top: 1px solid #dddddc;
border-radius: 5px;

font-size: 16px;
color: #767571;

cursor: pointer;

&:hover {
border-top-color: #ebebea;
background-color: #ebebea;
}
}

/* 에디터 */

.editor {
display: flex;
flex-direction: column;

margin: 50px 10px 10px 10px;

* {
margin-bottom: 10px;
padding: 10px;

border: none;
border-radius: 8px;
outline: none;
background-color: none;

&:hover {
background-color: #f5f5f5;
transition: background-color 0.5s ease-in-out;
}

&:active {
background-color: #f5f5f5;
}
}

.title {
font-size: 30px;
font-weight: bold;
}

.content {
font-size: 15px;
}
}
4 changes: 2 additions & 2 deletions src/components/Editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ export default function Editor({
this.render = () => {
if (!isInitialize) {
Copy link

Choose a reason for hiding this comment

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

isInitialize 라는 별도의 변수를 두기보단, innerHTML이 비어있는지 여부로 체크도 가능할 것 같아요.
(가능하면 변수의 사용을 줄이는 것이 읽기 좋기에..)

$editor.innerHTML = `
<input type="text" name="title" style="width: 600px;" value="${this.state.title}" />
<textarea name="content" style="width: 600px; height: 400px;">${this.state.content}</textarea>
<input class="title" type="text" name="title" style="width: 600px;" value="${this.state.title}" />
<textarea class="content" name="content" style="width: 600px; height: 400px;">${this.state.content}</textarea>
`;

isInitialize = true;
Expand Down
3 changes: 2 additions & 1 deletion src/components/LinkButton.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { push } from "../utils/router.js";

export default function LinkButton({ $target, initialState }) {
export default function LinkButton({ $target, initialState, className }) {
this.state = initialState;

const $linkButton = document.createElement("button");
$linkButton.setAttribute("class", className);
$target.appendChild($linkButton);

this.render = () => {
Expand Down
5 changes: 3 additions & 2 deletions src/pages/PostsPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export default function PostsPage({ $target }) {
this.setState();
push(`/posts/${createdPost.id}`);
},
onDelete: async(postId) => {
onDelete: async (postId) => {
await deletePost(postId);
this.setState();
history.replaceState(null, null, "/");
Expand All @@ -29,9 +29,10 @@ export default function PostsPage({ $target }) {
new LinkButton({
$target: $page,
initialState: {
text: "페이지 추가",
text: "+ 새 페이지",
link: "/posts/new",
},
className: "page-create",
});

this.setState = async () => {
Expand Down
20 changes: 12 additions & 8 deletions src/utils/renderPosts.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,18 @@ export const renderPosts = (root, posts, sub) => {
let $li = document.createElement("li");
$li.setAttribute("data-id", post.id);
$li.innerHTML = `
${post.title ? post.title : "제목 없음"}
${
!sub
? `
<button class="post-create">+</button>
<button class="post-delete">x</button>`
: ""
}
<div class="post">
<div>
<button class="toggle-button">&#9656;</button>
<span class="post-title">${post.title ? post.title : "제목 없음"}</span>
</div>
${!sub? `
<div class="button-group">
<button class="post-create">&#10010;</button>
<button class="post-delete">&#10006;</button>
</div>` : ""
}
</div>
`;

$ul.appendChild($li);
Expand Down