-
Notifications
You must be signed in to change notification settings - Fork 29
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
base: 4/#5_HowonShin
Are you sure you want to change the base?
Changes from 42 commits
3067a6c
a4bf0ab
a803b13
9a85444
d559dbe
4399af0
e72d984
67b0ce3
ccfe9ca
c3ad7fa
599bc32
e764def
678baf8
5e39397
e3b03e6
c999cdc
fc0902e
6eafb07
2e6fc51
c7e81ab
772e097
ebd45e6
7ca7794
91a87ce
20479ae
26b98b1
1925391
19f9205
85ea18e
d968ca3
65b3d61
20702cf
85f4dfc
a43b6f8
960f583
1f972ac
a07b858
826a2fe
0275de0
8e2377b
82e66ea
6482d4f
78f9744
47066b3
ba04315
b66777b
040f676
2b30e90
444813a
0ee6a1c
174f5e0
e41a665
49015c0
32d6122
717b91c
7e4febe
776f386
f2108f9
d8909b9
eb41e10
c79c371
90e8ccf
fe7094d
5d0fc8d
845fca8
0db76b4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"presets": ["@babel/preset-env"], | ||
"plugins": [ | ||
[ | ||
"module-resolver", | ||
{ | ||
"alias": { | ||
"@Components": "./src/components", | ||
"@Utils": "./src/utils", | ||
"@Static": "./src/static" | ||
} | ||
} | ||
] | ||
] | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"env": { | ||
"browser": true | ||
}, | ||
"extends": ["airbnb-base", "prettier", "plugin:import/recommended"], | ||
"overrides": [], | ||
"parserOptions": { | ||
"ecmaVersion": "latest", | ||
"sourceType": "module" | ||
}, | ||
"plugins": ["import", "prettier"], | ||
"root": true, | ||
"rules": { | ||
"prettier/prettier": ["error"] | ||
} | ||
} |
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 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
"printWidth": 80, | ||
"tabWidth": 2, | ||
"semi": true, | ||
"singleQuote": false, | ||
"trailingComma": "es5", | ||
"bracketSpacing": true, | ||
"quoteProps": "as-needed", | ||
"arrowParens": "always", | ||
"endOfLine": "lf" | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"compilerOptions": { | ||
"module": "ES2022", | ||
"baseUrl": ".", | ||
"paths": { | ||
"@Components/*": ["./src/components/*"], | ||
"@Utils/*": ["./src/utils/*"], | ||
"@Static/*": ["./src/static/*"] | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
{ | ||
"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" | ||
}, | ||
"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": "^4.2.1", | ||
"html-loader": "^4.2.0", | ||
"html-webpack-plugin": "^5.5.3", | ||
"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" | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<base href="/"> | ||
<title>Hotion</title> | ||
</head> | ||
<body> | ||
<main class="app"></main> | ||
</body> | ||
</html> |
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; | ||
} | ||
|
||
.page-container { | ||
flex: 1 1 0%; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { patchSidebarState, registerStateSetter } from "@Utils/stateSetters"; | ||
import Document from "./Document/Document"; | ||
import Home from "./Home/Home"; | ||
howons marked this conversation as resolved.
Show resolved
Hide resolved
|
||
import router from "@Utils/router"; | ||
import Header from "./Header/Header"; | ||
import Sidebar from "./Sidebar/Sidebar"; | ||
import "./App.css"; | ||
|
||
export default function App({ $target }) { | ||
// 기본 레이아웃 요소 생성 | ||
const $sidebar = new Sidebar({ $target }); | ||
registerStateSetter($sidebar); | ||
patchSidebarState(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. registerStateSetter() 와 patchSidebarState() 함수는 어떤 이유로 사용하지는건지 궁금합니다! 제 생각에는 각 컴포넌트의 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. document가 헤더나 사이드바의 상태 업데이트를 시켜줘야 하다보니 나름대로의 store? 를 구현해보려고 한 건데 데이터 흐름이 직관적이지 않게 된 것 같네요. |
||
|
||
const $main = document.createElement("div"); | ||
const $header = new Header({ $target: $main }); | ||
registerStateSetter($header); | ||
|
||
const $content = document.createElement("article"); | ||
|
||
$main.className = "main-container"; | ||
$content.className = "page-container"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. $content컴포넌트에 $home과 $document 컴포넌트를 연결해주신 것 같습니다. 로고 버튼을 클릭하면 home 컴포넌트를 렌더링하고, 사이드바의 document를 클릭하면 Document 컴포넌트를 렌더링 하는 것 같습니다. 그런데 그러다보니, 다른 document를 보려고 클릭하면 $content를 다시 렌더링 하게 되니까 화면 깜박임(Flickering) 현상이 발생하는 것 같습니다. $home, $document 컴포넌트의 렌더링 시점을 분리하면 좋을 것 같습니다! |
||
|
||
$main.appendChild($content); | ||
$target.appendChild($main); | ||
|
||
// route 가능한 요소 등록 | ||
const $home = new Home({ $target: $content }); | ||
registerStateSetter($home); | ||
|
||
const $document = new Document({ $target: $content }); | ||
registerStateSetter($document); | ||
|
||
const route = () => router({ $target: $content }); | ||
window.addEventListener("load", route); | ||
window.addEventListener("popstate", route); | ||
window.addEventListener("route", route); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
.document-container { | ||
padding: 15px; | ||
height: 100%; | ||
box-sizing: border-box; | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
} | ||
|
||
.document-title-section { | ||
margin: 1em 0 1em 0; | ||
} | ||
|
||
.document-title-section > textarea { | ||
width: 550px; | ||
height: 1.5em; | ||
font-size: 3em; | ||
border: none; | ||
resize: none; | ||
} | ||
|
||
.document-title-section > textarea:focus { | ||
outline: none; | ||
} | ||
|
||
.document-content-section > textarea { | ||
width: 550px; | ||
height: 70vh; | ||
font-size: 1.5em; | ||
border: none; | ||
resize: none; | ||
} | ||
|
||
.document-content-section > textarea:focus { | ||
outline: none; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
alias 잘 해두셨네요!!
이건 저도 아직 못찾아봤는데 @(골뱅이) 이후에 대문자를 사용하는게 일반적인지는 저도 궁금하네요.
저는 여지까지 소문자로 써왔었긴 했습니다.( alias라서 개인 취향일 지도 모르고요! )
혹은 프로젝트가 커지면 나중에는 폴더가 너무 많아져서 alias를 각각 걸기 힘들어서 이렇게 걸리도합니다.
그리고
@/components
이렇게 접근하기도 합니다