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

[12팀 하정원] 프레임워크 없이 SPA 만들기 #16

Closed
wants to merge 33 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
01db11c
config: add .prettierrc
JayeHa Sep 22, 2024
4eb4790
feat: App.ts 추가 및 Typescript로의 전환
JayeHa Sep 22, 2024
4b9c94c
feat: Router 추가
JayeHa Sep 22, 2024
b127c7e
refactor: 페이지 컴포넌트를 BasePage 클래스로 통합
JayeHa Sep 22, 2024
99ee351
feat: Header 컴포넌트 추가 (4. 컴포넌트 기반 구조 설계)
JayeHa Sep 22, 2024
95b9af7
feat: localStorage 추가
JayeHa Sep 22, 2024
8214b4b
refactor: BaseComponent에 abstract 추가
JayeHa Sep 22, 2024
25b641a
feat: 로그인, 로그아웃 구현
JayeHa Sep 22, 2024
81247da
refactor: BasePage 컴포넌트를 BaseComponent로 통합
JayeHa Sep 22, 2024
360155f
feat: 프로필 수정기능 추가
JayeHa Sep 22, 2024
b2075c7
refactor: BaseComponent 리펙토링
JayeHa Sep 23, 2024
6e73ee7
refactor: 폴더구조 변경
JayeHa Sep 23, 2024
e0a6432
fix: 잘못된 셀프 클로징 div 태그 수정 (header container 관련)
JayeHa Sep 23, 2024
962c1d1
fix: `beforeRender` 메서드 추가
JayeHa Sep 23, 2024
f528115
chore: delete README.md
JayeHa Sep 23, 2024
28d664d
feat: Footer 컴포넌트 추가
JayeHa Sep 23, 2024
0c8735e
feat(home): 동적 컨텐츠 렌더링
JayeHa Sep 23, 2024
1d267cf
refactor: 상태 변경 함수(setState) 구현
JayeHa Sep 23, 2024
8b919fe
feat: 로그인 실패 시 에러 메시지 표시
JayeHa Sep 23, 2024
760a74e
refactor: profile 페이지에서 이벤트 바인딩 분리
JayeHa Sep 23, 2024
2ea009a
chore: 테스트코드 성공을 위한 주석처리
JayeHa Sep 23, 2024
3e0f487
feat: 라우트 가드 구현
JayeHa Sep 23, 2024
05ff74d
refactor: 라우터 및 컴포넌트 초기화 방식 수정
sb-jungwon Sep 24, 2024
64b772d
Merge branch 'basic' into advenced
sb-jungwon Sep 24, 2024
82c5790
Merge branch 'basic' into advenced
sb-jungwon Sep 24, 2024
366b609
Merge branch 'advenced' of https://github.com/JayeHa/front_3rd_chatpe…
JayeHa Sep 24, 2024
6a8b67d
feat: 에러바운더리 우회적으로 구현
JayeHa Sep 24, 2024
da334cf
feat: 사용자 이름 검증
JayeHa Sep 25, 2024
6a53143
Merge remote-tracking branch 'upstream/main' into advenced
JayeHa Sep 25, 2024
a2f6431
fix: resolve merge error
JayeHa Sep 25, 2024
15b0fe7
config: 타입스크립트 설치
JayeHa Sep 25, 2024
d836c0a
refactor
JayeHa Sep 26, 2024
4678955
fix: prettierignore 추가
JayeHa Sep 26, 2024
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
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
**/*.test.js

11 changes: 11 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"printWidth": 80,
"tabWidth": 2,
"useTabs": false,
"semi": true,
"singleQuote": true,
"trailingComma": "es5",
"bracketSpacing": true,
"jsxBracketSameLine": false,
"arrowParens": "always"
}
Comment on lines +1 to +11
Copy link
Author

Choose a reason for hiding this comment

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

pritter는 제 vscode의 설정과 다른 부분이 있어서 기본값들도 명시적으로 설정했습니다 :)

22 changes: 11 additions & 11 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<!doctype html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>항해플러스 SNS</title>
<script src="https://cdn.tailwindcss.com"></script>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.js"></script>
</body>
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>항해플러스 SNS</title>
<script src="https://cdn.tailwindcss.com"></script>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.ts"></script>
</body>
</html>
33 changes: 33 additions & 0 deletions package-lock.json

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

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"@testing-library/user-event": "^14.5.2",
"@vitest/ui": "^2.1.1",
"jsdom": "^25.0.0",
"typescript": "^5.6.2",
Copy link
Member

Choose a reason for hiding this comment

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

오~

"vite": "^5.1.0",
"vitest": "^2.1.1"
}
Expand Down
16 changes: 16 additions & 0 deletions src/App.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import ErrorPage from './pages/error';
import HomePage from './pages/home';
import LoginPage from './pages/login';
import ProfilePage from './pages/profile';
import { router } from './shared/util/Router';

export default class App {
constructor(selector: string) {
router.init({
'/': () => new HomePage(selector),
'/login': () => new LoginPage(selector),
'/profile': () => new ProfilePage(selector),
'/404': () => new ErrorPage(selector),
});
}
}
2 changes: 1 addition & 1 deletion src/__tests__/advanced.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ beforeAll(async () => {
// DOM 초기화
window.alert = vi.fn();
document.body.innerHTML = '<div id="root"></div>';
await import('../main.js');
await import('../main.ts');
})

afterAll(() => {
Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/basic.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ beforeAll(async () => {
// DOM 초기화
window.alert = vi.fn();
document.body.innerHTML = '<div id="root"></div>';
await import('../main.js');
await import('../main.ts');
})

afterAll(() => {
Expand Down
111 changes: 0 additions & 111 deletions src/main.js

This file was deleted.

3 changes: 3 additions & 0 deletions src/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import App from './App';

new App('#root');
20 changes: 20 additions & 0 deletions src/pages/error.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { BaseComponent } from '../shared/ui/BaseComponent';

export default class ErrorPage extends BaseComponent {
template() {
return `
<main class="bg-gray-100 flex items-center justify-center min-h-screen">
<div class="bg-white p-8 rounded-lg shadow-md w-full text-center" style="max-width: 480px">
<h1 class="text-2xl font-bold text-blue-600 mb-4">항해플러스</h1>
<p class="text-4xl font-bold text-gray-800 mb-4">404</p>
<p class="text-xl text-gray-600 mb-8">페이지를 찾을 수 없습니다</p>
<p class="text-gray-600 mb-8">
요청하신 페이지가 존재하지 않거나 이동되었을 수 있습니다.
</p>
<a href="/" class="bg-blue-600 text-white px-4 py-2 rounded font-bold">
홈으로 돌아가기
</a>
</div>
</main>`;
}
}
Loading
Loading