-
Notifications
You must be signed in to change notification settings - Fork 28
[Mission4/원다연] - Project_Notion_VanillaJS #32
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
Open
dazzel3
wants to merge
22
commits into
prgrms-fe-devcourse:3/#4_wondayeon
Choose a base branch
from
dazzel3:main
base: 3/#4_wondayeon
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 21 commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
dff0fc9
feat: create DocumentHeader component
dazzel3 87432c5
feat: add assets
dazzel3 990f555
feat: add css files
dazzel3 5c85daa
feat: create DocumentFooter component
dazzel3 d760e19
fix: img render error
dazzel3 27a5a65
feat: create DocumentList component
dazzel3 d7ee92f
feat: add gitignore
dazzel3 e68e0e5
feat: add onCreate function
dazzel3 9efb7ac
feat: create Editor component
dazzel3 42dd354
fix: add overflow-y and cursor style
dazzel3 b2db2c8
fix: change relative path to absolute path
dazzel3 d8b90b7
feat: create router component
dazzel3 85d8d3f
feat: add function (span click to get data)
dazzel3 c348f4c
fix: click bug on editor data
dazzel3 74e0d8b
refactor: wip
dazzel3 75f09a2
fix: change dom object
dazzel3 c81a50b
refactor: seperate document li to render.js
dazzel3 d360115
feat: add onSet, onAdd, onToggle function
dazzel3 6b2a4ff
fix: change e.target
dazzel3 756db07
feat: add css style
dazzel3 81ebd7b
feat: add onScroll function
dazzel3 d8cad4d
Update README.md
dazzel3 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| # API_END_POINT | ||
| src/utils/variable.js |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,148 @@ | ||
| /* http://meyerweb.com/eric/tools/css/reset/ | ||
| v2.0 | 20110126 | ||
| License: none (public domain) | ||
| */ | ||
|
|
||
| html, | ||
| body, | ||
| div, | ||
| span, | ||
| applet, | ||
| object, | ||
| iframe, | ||
| h1, | ||
| h2, | ||
| h3, | ||
| h4, | ||
| h5, | ||
| h6, | ||
| p, | ||
| blockquote, | ||
| pre, | ||
| a, | ||
| abbr, | ||
| acronym, | ||
| address, | ||
| big, | ||
| cite, | ||
| code, | ||
| del, | ||
| dfn, | ||
| em, | ||
| img, | ||
| ins, | ||
| kbd, | ||
| q, | ||
| s, | ||
| samp, | ||
| small, | ||
| strike, | ||
| strong, | ||
| sub, | ||
| sup, | ||
| tt, | ||
| var, | ||
| b, | ||
| u, | ||
| i, | ||
| center, | ||
| dl, | ||
| dt, | ||
| dd, | ||
| ol, | ||
| ul, | ||
| li, | ||
| fieldset, | ||
| form, | ||
| label, | ||
| legend, | ||
| table, | ||
| caption, | ||
| tbody, | ||
| tfoot, | ||
| thead, | ||
| tr, | ||
| th, | ||
| td, | ||
| article, | ||
| aside, | ||
| canvas, | ||
| details, | ||
| embed, | ||
| figure, | ||
| figcaption, | ||
| footer, | ||
| header, | ||
| hgroup, | ||
| menu, | ||
| nav, | ||
| output, | ||
| ruby, | ||
| section, | ||
| summary, | ||
| time, | ||
| mark, | ||
| audio, | ||
| video { | ||
| margin: 0; | ||
| padding: 0; | ||
| border: 0; | ||
| font-size: 100%; | ||
| font: inherit; | ||
| vertical-align: baseline; | ||
| } | ||
| /* HTML5 display-role reset for older browsers */ | ||
| article, | ||
| aside, | ||
| details, | ||
| figcaption, | ||
| figure, | ||
| footer, | ||
| header, | ||
| hgroup, | ||
| menu, | ||
| nav, | ||
| section { | ||
| display: block; | ||
| } | ||
| body { | ||
| line-height: 1; | ||
| } | ||
| ol, | ||
| ul { | ||
| list-style: none; | ||
| } | ||
| blockquote, | ||
| q { | ||
| quotes: none; | ||
| } | ||
| blockquote:before, | ||
| blockquote:after, | ||
| q:before, | ||
| q:after { | ||
| content: ''; | ||
| content: none; | ||
| } | ||
| table { | ||
| border-collapse: collapse; | ||
| border-spacing: 0; | ||
| } | ||
| button { | ||
| border: none; | ||
| background-color: transparent; | ||
| padding: 0; | ||
| margin: 0; | ||
| } | ||
| input { | ||
| border: none; | ||
| outline: none; | ||
| } | ||
| textarea { | ||
| border: none; | ||
| resize: none; | ||
| outline: none; | ||
| } | ||
| input::placeholder, | ||
| textarea::placeholder { | ||
| color: #d7d7d7; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,162 @@ | ||
| @font-face { | ||
| font-family: 'Pretendard-Regular'; | ||
| src: url('https://cdn.jsdelivr.net/gh/Project-Noonnu/noonfonts_2107@1.1/Pretendard-Regular.woff') | ||
| format('woff'); | ||
| font-weight: 400; | ||
| font-style: normal; | ||
| } | ||
| @font-face { | ||
| font-family: 'Pretendard-Bold'; | ||
| src: url('https://cdn.jsdelivr.net/gh/Project-Noonnu/noonfonts_2107@1.1/Pretendard-Bold.woff') | ||
| format('woff'); | ||
| font-weight: 700; | ||
| font-style: normal; | ||
| } | ||
|
|
||
| main { | ||
| display: flex; | ||
| width: 100%; | ||
| height: 100vh; | ||
| font-family: 'Pretendard-Regular'; | ||
| } | ||
|
|
||
| /* 리스트 영역 */ | ||
| .document-container { | ||
| width: 20%; | ||
| height: 100%; | ||
| display: flex; | ||
| flex-direction: column; | ||
| justify-content: space-between; | ||
| background-color: #f7f5f0; | ||
| color: #696969; | ||
| } | ||
| .document-fix { | ||
| width: 100%; | ||
| height: fit-content; | ||
| padding: 3vh 0; | ||
| font-size: 16px; | ||
| } | ||
| .document-header { | ||
| border-bottom: 1px solid #e0e0e0; | ||
| } | ||
| .document-header span { | ||
| padding-left: 2vh; | ||
| font-weight: 600; | ||
| } | ||
| .document-list { | ||
| width: 100%; | ||
| height: calc(100% - 12vh); | ||
| overflow: hidden; | ||
| overflow-y: auto; | ||
| } | ||
| .document-list ul { | ||
| padding-left: 2vh; | ||
| } | ||
| .document { | ||
| width: 100%; | ||
| height: fit-content; | ||
| padding: 1.5vh 0; | ||
| display: flex; | ||
| align-items: center; | ||
| } | ||
| li div:hover { | ||
| background-color: #e8e6e0de; | ||
| } | ||
| .document span { | ||
| width: 70%; | ||
| overflow: hidden; | ||
| white-space: nowrap; | ||
| text-overflow: ellipsis; | ||
| font-size: 15px; | ||
| cursor: pointer; | ||
| } | ||
| .bold { | ||
| font-weight: 800; | ||
| color: #2d2d2d; | ||
| background-color: #e8e6e0de; | ||
| } | ||
| .no-child { | ||
| padding-left: 2.5vh; | ||
| } | ||
| .document-footer { | ||
| display: flex; | ||
| align-items: center; | ||
| border-top: 1px solid #e0e0e0; | ||
| } | ||
| button { | ||
| width: 24px; | ||
| height: 24px; | ||
| margin: 0 0.7vh; | ||
| display: flex; | ||
| justify-content: center; | ||
| align-items: center; | ||
| cursor: pointer; | ||
| border-radius: 4px; | ||
| } | ||
| button:hover { | ||
| background-color: #cac8c5cc; | ||
| } | ||
| button img { | ||
| width: fit-content; | ||
| height: 100%; | ||
| opacity: 0.7; | ||
| background-size: 100%; | ||
| } | ||
| .toggle { | ||
| width: fit-content; | ||
| height: 80%; | ||
| content: url('../assets/right.png'); | ||
| } | ||
| .toggle-active { | ||
| content: url('../assets/down.png'); | ||
| } | ||
| .delete { | ||
| content: url('../assets/delete.png'); | ||
| } | ||
| .plus { | ||
| width: fit-content; | ||
| height: 60%; | ||
| content: url('../assets/plus.png'); | ||
| } | ||
| .create-button { | ||
| width: 100%; | ||
| justify-content: left; | ||
| font-family: 'Pretendard-Regular'; | ||
| margin: 0; | ||
| border-radius: 0; | ||
| } | ||
| .create-button:hover { | ||
| background-color: #d4d3cdde !important; | ||
| } | ||
| .create-button img { | ||
| width: 18px; | ||
| height: 18px; | ||
| padding: 0 2vh; | ||
| } | ||
|
|
||
| /* 에디터 영역 */ | ||
| .editor-container { | ||
| width: 80%; | ||
| height: 100%; | ||
| display: flex; | ||
| justify-content: center; | ||
| align-items: center; | ||
| } | ||
| .editor { | ||
| width: 80%; | ||
| height: 80%; | ||
| } | ||
| .title { | ||
| width: 100%; | ||
| padding: 10px 0; | ||
| font-family: 'Pretendard-Bold'; | ||
| font-size: 42px; | ||
| margin-bottom: 25px; | ||
| } | ||
| .content { | ||
| width: 100%; | ||
| height: 80%; | ||
| font-family: 'Pretendard-Regular'; | ||
| font-size: 18px; | ||
| color: #000000; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| <!DOCTYPE html> | ||
| <html lang="ko"> | ||
| <head> | ||
| <meta charset="UTF-8" /> | ||
| <meta http-equiv="X-UA-Compatible" content="IE=edge" /> | ||
| <meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
| <title>원다연의 Notion</title> | ||
| <link rel="stylesheet" href="/css/reset.css" /> | ||
| <link rel="stylesheet" href="/css/style.css" /> | ||
| </head> | ||
| <body> | ||
| <main id="app"></main> | ||
| <script src="/src/main.js" type="module"></script> | ||
| </body> | ||
| </html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| import DocumentPage from './pages/DocumentPage.js'; | ||
| import EditorPage from './pages/EditorPage.js'; | ||
| import { initRouter } from './utils/router.js'; | ||
|
|
||
| export default function App({ $target }) { | ||
| const $document = document.createElement('section'); | ||
| const $editor = document.createElement('section'); | ||
|
|
||
| $document.className = 'document-container'; | ||
| $editor.className = 'editor-container'; | ||
|
|
||
| $target.appendChild($document); | ||
| $target.appendChild($editor); | ||
|
|
||
| new DocumentPage({ | ||
| $target: $document, | ||
| }); | ||
|
|
||
| const editorPage = new EditorPage({ | ||
| $target: $editor, | ||
| initialState: { | ||
| documentId: '', | ||
| post: { | ||
| title: '', | ||
| content: '', | ||
| }, | ||
| }, | ||
| }); | ||
|
|
||
| this.route = () => { | ||
| const { pathname } = window.location; | ||
| if (pathname.indexOf('/documents/') === 0) { | ||
| const [, , documentId] = pathname.split('/'); | ||
| editorPage.setState({ documentId }); | ||
| } | ||
| }; | ||
|
|
||
| this.route(); | ||
|
|
||
| initRouter(() => this.route()); | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| export default function DocumentFooter({ $target, onCreate, onScroll }) { | ||
| const $button = document.createElement('button'); | ||
| $button.className = 'document-fix document-footer create-button'; | ||
| $target.appendChild($button); | ||
|
|
||
| this.render = () => { | ||
| $button.innerHTML = ` | ||
| <img class='plus new' /> | ||
| ${'새 페이지'} | ||
|
Member
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.querySelector('.new').setAttribute('src', '../../assets/plus.png'); | ||
|
|
||
| $button.addEventListener('click', () => { | ||
| onCreate(); | ||
| onScroll(); | ||
|
Comment on lines
+15
to
+16
Member
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. 이게 지난번 개인면담때 질문하셨던 코드인것 같네요. 혹시 그때 제가 말씀드린 부분에 맞추어서 추가적인 테스트 등 진행해보셨을까요? ㅎㅎ |
||
| }); | ||
| }; | ||
|
|
||
| this.render(); | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
document 컨테이너 생성 및 editor 컨테이너 생성에 대한 함수를 만들어서 호출하는 형태로 하면 더 좋지 않을까요? 동일 코드의 반복같습니다 :)