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

[Mission5/신호원] Project_Notion_Vanilla JS 과제 #45

Open
wants to merge 66 commits into
base: 4/#5_HowonShin
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
3067a6c
Init: 프로젝트 생성
howons Jul 1, 2023
a4bf0ab
Chore: dependency 설치
howons Jul 1, 2023
a803b13
Feat: 초기 파일 추가
howons Jul 1, 2023
9a85444
Feat: webpack 구성 파일 추가
howons Jul 1, 2023
d559dbe
Feat: yarn 스크립트 추가
howons Jul 1, 2023
4399af0
Feat: babel 구성 파일 추가
howons Jul 1, 2023
e72d984
Feat: eslint 구성 파일 추가
howons Jul 1, 2023
67b0ce3
Feat: prettier 구성 파일 추가
howons Jul 1, 2023
ccfe9ca
Chore: import alias 설정
howons Jul 2, 2023
c3ad7fa
Feat: new 생성자 검증 기능 추가
howons Jul 3, 2023
599bc32
Feat: route 테스트 및 콘솔 에러 제거
howons Jul 3, 2023
e764def
Feat: setState 저장소 분리
howons Jul 4, 2023
678baf8
Feat: 임시 Home 컴포넌트 추가
howons Jul 4, 2023
5e39397
Feat: router 분리
howons Jul 4, 2023
e3b03e6
Feat: 기본 레이아웃 설정
howons Jul 4, 2023
c999cdc
Feat: setState 분리 및 once 함수 구현
howons Jul 4, 2023
fc0902e
Feat: setState 및 validation 개선
howons Jul 5, 2023
6eafb07
Feat: 사이드바 기본 구조 구현 및 api 연결
howons Jul 5, 2023
2e6fc51
Fix: Drawer 레벨 추가
howons Jul 5, 2023
c7e81ab
Feat: 자식 Drawer 열고닫기 추가
howons Jul 5, 2023
772e097
Feat: 문서 생성기능 추가
howons Jul 6, 2023
ebd45e6
Feat: 루트 문서 생성 버튼 추가
howons Jul 6, 2023
7ca7794
Feat: 사이드바 스크롤 추가
howons Jul 6, 2023
91a87ce
Feat: 문서 생성 시 하위 목록 열리게 수정
howons Jul 6, 2023
20479ae
Feat: 문서 삭제 기능 추가
howons Jul 6, 2023
26b98b1
Feat: Draw 클릭 시 route 기능 구현
howons Jul 6, 2023
1925391
Feat: 문서 정보 불러오기 구현
howons Jul 6, 2023
19f9205
Feat: 문서 저장 기능 추가
howons Jul 6, 2023
85ea18e
Feat: DrawerItem 강조 효과 추가 및 패딩 방식 변경
howons Jul 6, 2023
d968ca3
Feat: 헤더 문서 네비게이션 추가
howons Jul 6, 2023
65b3d61
Feat: 사이드바와 헤더에 낙관적 업데이트 추가
howons Jul 6, 2023
20702cf
Feat: 헤더 문서 링크 추가
howons Jul 6, 2023
85f4dfc
Style: Document 스타일 적용
howons Jul 6, 2023
a43b6f8
Style: 사이드바 아이콘 추가 및 스타일 수정
howons Jul 6, 2023
960f583
Feat: Home 페이지 추가 및 로컬 스토리지 설정
howons Jul 7, 2023
1f972ac
Feat: Home 스타일 및 링크 추가
howons Jul 7, 2023
a07b858
Style: Home 로고 스타일 수정
howons Jul 7, 2023
826a2fe
Fix: Home에 남아있는 Header 정보 초기화
howons Jul 7, 2023
0275de0
Feat: 문서 삭제 시 로컬 스토리지 및 페이지 처리
howons Jul 7, 2023
8e2377b
Fix: DrawerItem 삭제 중 클릭 방지 구현
howons Jul 7, 2023
82e66ea
Style: 제목 글자 분리 수정
howons Jul 7, 2023
6482d4f
Chore: Fix webpack config
howons Jul 7, 2023
78f9744
Fix: webpack publickPath 수정
howons Jul 7, 2023
47066b3
Refactor: 적용 안되던 eslint 적용 및 수정
howons Jul 16, 2023
ba04315
Fix: event 이름 상수 처리
howons Jul 16, 2023
b66777b
Refactor: stateSetter 사용 추상화
howons Jul 16, 2023
040f676
Rename: validation 함수 이름 변경
howons Jul 16, 2023
2b30e90
Rename: App 위치 변경
howons Jul 16, 2023
444813a
Rename: Home을 Dashboard로 개명
howons Jul 16, 2023
0ee6a1c
Rename: route 대상 요소 pages로 이동
howons Jul 16, 2023
174f5e0
Merge pull request #61 from Howon-Shin/4/#5_HowonShin_working
howons Jul 16, 2023
e41a665
Refactor: Document init 함수 기능 추상화
howons Jul 16, 2023
49015c0
Rename: numUsed를 usedCount로 개명
howons Jul 16, 2023
32d6122
Rename: most를 frequent로 개명
howons Jul 16, 2023
717b91c
Refactor: title 제목없음 로직 간단하게 수정
howons Jul 16, 2023
7e4febe
Refactor: parent DrawerItem 관련 재귀 하나로 통합
howons Jul 16, 2023
776f386
Refactor: DrawerItem 이벤트 핸들러 정리
howons Jul 16, 2023
f2108f9
Fix: margin을 padding으로 변경
howons Jul 16, 2023
d8909b9
Style: header title css 보강
howons Jul 16, 2023
eb41e10
Rename: delete api 응답 받는 변수이름 수정
howons Jul 16, 2023
c79c371
Fix: 문서 생성 후 이동 기능 추가
howons Jul 16, 2023
90e8ccf
Refactor: 헤더 렌더링 nav 범위로 축소
howons Jul 17, 2023
fe7094d
Rename: Drawer를 DocumentList로 개명
howons Jul 17, 2023
5d0fc8d
Fix: 문서 삭제 시 replaceState 처리
howons Jul 17, 2023
845fca8
Fix: document, dashboard 페이지 라우팅 시 플리커링 제거
howons Jul 17, 2023
0db76b4
Fix: 동일 문서 route 시 pushState 미적용
howons Jul 17, 2023
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
16 changes: 16 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"presets": ["@babel/preset-env"],
"plugins": [
[
"module-resolver",
{
"alias": {
"@Components": "./src/components",
"@Pages": "./src/pages",
"@Utils": "./src/utils",
"@Static": "./src/static"
}
}
]
]
}
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dist/
23 changes: 23 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"env": {
"browser": true
},
"extends": ["airbnb-base", "prettier", "plugin:import/recommended"],
"overrides": [],
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module"
},
"plugins": ["import", "prettier"],
"root": true,
"rules": {
"no-alert": "off",
"no-console": "warn",
"no-new": "off",
"no-unused-vars": "warn",
"no-use-before-define": "warn",
"import/no-cycle": "off",
"import/no-unresolved": "off",
"prettier/prettier": ["error"]
}
}
144 changes: 144 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
# Created by https://www.toptal.com/developers/gitignore/api/node
# Edit at https://www.toptal.com/developers/gitignore?templates=node

### Node ###
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
.pnpm-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# Snowpack dependency directory (https://snowpack.dev/)
web_modules/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional stylelint cache
.stylelintcache

# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variable files
.env
.env.development.local
.env.test.local
.env.production.local
.env.local

# parcel-bundler cache (https://parceljs.org/)
.cache
.parcel-cache

# Next.js build output
.next
out

# Nuxt.js build / generate output
.nuxt
dist

# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and not Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public

# vuepress build output
.vuepress/dist

# vuepress v2.x temp and cache directory
.temp

# Docusaurus cache and generated files
.docusaurus

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# TernJS port file
.tern-port

# Stores VSCode versions used for testing VSCode extensions
.vscode-test

# yarn v2
.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*

### Node Patch ###
# Serverless Webpack directories
.webpack/

# Optional stylelint cache

# SvelteKit build / generate output
.svelte-kit

# End of https://www.toptal.com/developers/gitignore/api/node
21 changes: 21 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
Copy link

Choose a reason for hiding this comment

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

재밌는(흥미로운) 점은, 호원님, 혜진님의 prettierrc 세팅이 다다르다는 것이네요!
정답이 있는게 아니라서 재밌다고 표현했습니다!

창욱님 세팅
혜진님 세팅

"printWidth": 80,
"tabWidth": 2,
"semi": true,
"singleQuote": false,
"trailingComma": "es5",
"bracketSpacing": true,
"quoteProps": "as-needed",
"arrowParens": "always",
"endOfLine": "lf",

"importOrder": [
"^@Components/(.*)$",
"^@Pages/(.*)$",
"^@Utils/(.*)$",
"^@Static/(.*)$",
"^[./]"
],
"importOrderSeparation": true,
"importOrderSortSpecifiers": true
}
12 changes: 12 additions & 0 deletions jsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"compilerOptions": {
"module": "ES2022",
"baseUrl": ".",
"paths": {
"@Components/*": ["./src/components/*"],
"@Pages/*": ["./src/pages/*"],
"@Utils/*": ["./src/utils/*"],
"@Static/*": ["./src/static/*"]
}
}
}
39 changes: 39 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"name": "Mission_4_5",
"version": "1.0.0",
"main": "main.js",
"repository": "[email protected]:prgrms-fe-devcourse/FEDC4-5_Project_Notion_VanillaJS.git",
"author": "Howon Shin <[email protected]>",
"license": "MIT",
"private": true,
"scripts": {
"start": "yarn serve:dev",
"build": "yarn build:prod",
"build:dev": "webpack --mode=development",
"build:prod": "webpack --mode=production",
"serve:dev": "webpack serve --mode=development",
"serve:prod": "webpack serve --mode=production",
"lint": "eslint './**/*.js'"
},
"devDependencies": {
"@babel/cli": "^7.22.5",
"@babel/core": "^7.22.5",
"@babel/preset-env": "^7.22.5",
"babel-loader": "^9.1.2",
"babel-plugin-module-resolver": "^5.0.0",
"css-loader": "^6.8.1",
"eslint": "^8.44.0",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-config-prettier": "^8.8.0",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-prettier": "5.0.0",
"html-loader": "^4.2.0",
"html-webpack-plugin": "^5.5.3",
"prettier": "^3.0.0",
"style-loader": "^3.3.3",
"svg-inline-loader": "^0.8.2",
"webpack": "^5.88.1",
"webpack-cli": "^5.1.4",
"webpack-dev-server": "^4.15.1"
}
}
11 changes: 11 additions & 0 deletions public/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Hotion</title>
</head>
<body>
<main class="app"></main>
</body>
</html>
20 changes: 20 additions & 0 deletions src/App.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
body {
margin: 0px;
}

.app {
display: flex;
width: 100vw;
height: 100vh;
}

.main-container {
display: flex;
flex-direction: column;
flex: 1 1 0%;
height: 100vh;
}

.document-container {
flex: 1 1 0%;
}
23 changes: 23 additions & 0 deletions src/App.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { patchSidebarState, registerStateSetter } from "@Utils/stateSetters";
import DocumentContainer from "@Components/DocumentContainer";
import Header from "@Components/Header/Header";
import Sidebar from "@Components/Sidebar/Sidebar";
import "./App.css";

export default function App({ $target }) {
// 기본 레이아웃 요소 생성
const sidebar = new Sidebar({ $target });
registerStateSetter(sidebar);
patchSidebarState();

const $main = document.createElement("div");

const header = new Header({ $target: $main });
registerStateSetter(header);

$main.className = "main-container";
$target.appendChild($main);

// route 로 변경되는 부분
new DocumentContainer({ $target: $main });
}
22 changes: 22 additions & 0 deletions src/components/DocumentContainer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { registerStateSetter } from "@Utils/stateSetters";
import router from "@Utils/router";
import { EVENT } from "@Utils/constants";
import Document from "@Pages/Document/Document";
import Dashboard from "../pages/Dashboard/Dashboard";

export default function DocumentContainer({ $target }) {
const $documentContainer = document.createElement("article");
$target.appendChild($documentContainer);
$documentContainer.className = "document-container";

const dashboard = new Dashboard({ $target: $documentContainer });
registerStateSetter(dashboard);

const hotionDocument = new Document({ $target: $documentContainer });
registerStateSetter(hotionDocument);

const route = () => router({ $target: $documentContainer });
window.addEventListener("load", route);
window.addEventListener("popstate", route);
window.addEventListener(EVENT.ROUTE, route);
}
30 changes: 30 additions & 0 deletions src/components/Header/Header.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
.header {
display: flex;
align-items: center;
justify-content: space-between;
height: 2em;
padding: 7px;
}

.header-nav {
display: flex;
align-items: center;
margin-left: 0.5em;
}

.header-title {
howons marked this conversation as resolved.
Show resolved Hide resolved
padding: 0.3em;
border-radius: 3px;
cursor: pointer;
user-select: none;
}

.header-title:hover {
background-color: #e6e6e6;
}

.header-title-divider {
margin: 0 0.5em 0 0.5em;
color: #848484;
user-select: none;
}
Loading