-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
100 additions
and
95 deletions.
There are no files selected for viewing
This file contains 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 |
---|---|---|
@@ -1,42 +1,44 @@ | ||
#root { | ||
max-width: 1280px; | ||
margin: 0 auto; | ||
padding: 2rem; | ||
text-align: center; | ||
max-width: 1280px; | ||
margin: 0 auto; | ||
padding: 2rem; | ||
text-align: center; | ||
} | ||
|
||
.logo { | ||
height: 6em; | ||
padding: 1.5em; | ||
will-change: filter; | ||
transition: filter 300ms; | ||
height: 6em; | ||
padding: 1.5em; | ||
will-change: filter; | ||
transition: filter 300ms; | ||
} | ||
|
||
.logo:hover { | ||
filter: drop-shadow(0 0 2em #646cffaa); | ||
filter: drop-shadow(0 0 2em #646cffaa); | ||
} | ||
|
||
.logo.react:hover { | ||
filter: drop-shadow(0 0 2em #61dafbaa); | ||
filter: drop-shadow(0 0 2em #61dafbaa); | ||
} | ||
|
||
@keyframes logo-spin { | ||
from { | ||
transform: rotate(0deg); | ||
} | ||
to { | ||
transform: rotate(360deg); | ||
} | ||
from { | ||
transform: rotate(0deg); | ||
} | ||
to { | ||
transform: rotate(360deg); | ||
} | ||
} | ||
|
||
@media (prefers-reduced-motion: no-preference) { | ||
a:nth-of-type(2) .logo { | ||
animation: logo-spin infinite 20s linear; | ||
} | ||
a:nth-of-type(2) .logo { | ||
animation: logo-spin infinite 20s linear; | ||
} | ||
} | ||
|
||
.card { | ||
padding: 2em; | ||
padding: 2em; | ||
} | ||
|
||
.read-the-docs { | ||
color: #888; | ||
color: #888; | ||
} |
This file contains 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
This file contains 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
This file contains 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 |
---|---|---|
@@ -1,28 +1,27 @@ | ||
@import url('https://fonts.googleapis.com/css2?family=Pretendard:wght@400;500;700&display=swap'); | ||
@import url("https://fonts.googleapis.com/css2?family=Pretendard:wght@400;500;700&display=swap"); | ||
|
||
@tailwind base; | ||
@tailwind components; | ||
@tailwind utilities; | ||
|
||
* { | ||
padding: 0; | ||
margin: 0; | ||
outline: none; | ||
padding: 0; | ||
margin: 0; | ||
outline: none; | ||
} | ||
|
||
input::-webkit-outer-spin-button, | ||
input::-webkit-inner-spin-button { | ||
-webkit-appearance: none; | ||
-webkit-appearance: none; | ||
} | ||
|
||
@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-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; | ||
} | ||
|
||
body { | ||
font-family: 'Pretendard', sans-serif; | ||
} | ||
font-family: "Pretendard", sans-serif; | ||
} |
This file contains 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 |
---|---|---|
@@ -1,10 +1,10 @@ | ||
import { StrictMode } from 'react' | ||
import { createRoot } from 'react-dom/client' | ||
import App from './App.tsx' | ||
import './index.css' | ||
import { StrictMode } from "react"; | ||
import { createRoot } from "react-dom/client"; | ||
import App from "./App.tsx"; | ||
import "./index.css"; | ||
|
||
createRoot(document.getElementById('root')!).render( | ||
createRoot(document.getElementById("root")!).render( | ||
<StrictMode> | ||
<App /> | ||
</StrictMode>, | ||
) | ||
</StrictMode> | ||
); |
This file contains 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 |
---|---|---|
@@ -1,83 +1,86 @@ | ||
// src/mockApi.ts | ||
export interface CommentType { | ||
id: number; | ||
text: string; | ||
timestamp: Date; | ||
modified?: boolean; | ||
id: number; | ||
text: string; | ||
timestamp: Date; | ||
modified?: boolean; | ||
} | ||
|
||
let comments: CommentType[] = [ | ||
{ | ||
id: 1, | ||
text: "프론트엔드 개발자인데도 백엔드 경험이 있네요 👍", | ||
timestamp: new Date(Date.now() - 86400000), // 1일 전 | ||
modified: true, | ||
}, | ||
// 초기 댓글을 추가할 수 있습니다. | ||
{ | ||
id: 1, | ||
text: "프론트엔드 개발자인데도 백엔드 경험이 있네요 👍", | ||
timestamp: new Date(Date.now() - 86400000), // 1일 전 | ||
modified: true, | ||
}, | ||
// 초기 댓글을 추가할 수 있습니다. | ||
]; | ||
|
||
/** | ||
* 댓글 목록을 가져오는 Mock API 함수 | ||
*/ | ||
export const getComments = (): Promise<CommentType[]> => { | ||
return new Promise((resolve) => { | ||
setTimeout(() => { | ||
resolve([...comments]); // 불변성을 위해 복사본 반환 | ||
}, 500); // 500ms 지연 | ||
}); | ||
return new Promise((resolve) => { | ||
setTimeout(() => { | ||
resolve([...comments]); // 불변성을 위해 복사본 반환 | ||
}, 500); // 500ms 지연 | ||
}); | ||
}; | ||
|
||
/** | ||
* 새로운 댓글을 추가하는 Mock API 함수 | ||
* @param text - 댓글 내용 | ||
*/ | ||
export const addComment = (text: string): Promise<CommentType> => { | ||
return new Promise((resolve) => { | ||
setTimeout(() => { | ||
const newComment: CommentType = { | ||
id: Date.now(), | ||
text, | ||
timestamp: new Date(), | ||
modified: false, | ||
}; | ||
comments = [newComment, ...comments]; | ||
resolve(newComment); | ||
}, 500); | ||
}); | ||
return new Promise((resolve) => { | ||
setTimeout(() => { | ||
const newComment: CommentType = { | ||
id: Date.now(), | ||
text, | ||
timestamp: new Date(), | ||
modified: false, | ||
}; | ||
comments = [newComment, ...comments]; | ||
resolve(newComment); | ||
}, 500); | ||
}); | ||
}; | ||
|
||
/** | ||
* 댓글을 삭제하는 Mock API 함수 | ||
* @param id - 삭제할 댓글의 ID | ||
*/ | ||
export const deleteComment = (id: number): Promise<void> => { | ||
return new Promise((resolve) => { | ||
setTimeout(() => { | ||
comments = comments.filter((comment) => comment.id !== id); | ||
resolve(); | ||
}, 500); | ||
}); | ||
return new Promise((resolve) => { | ||
setTimeout(() => { | ||
comments = comments.filter((comment) => comment.id !== id); | ||
resolve(); | ||
}, 500); | ||
}); | ||
}; | ||
|
||
/** | ||
* 댓글을 수정하는 Mock API 함수 | ||
* @param id - 수정할 댓글의 ID | ||
* @param newText - 새로운 댓글 내용 | ||
*/ | ||
export const editComment = (id: number, newText: string): Promise<CommentType> => { | ||
return new Promise((resolve, reject) => { | ||
setTimeout(() => { | ||
const commentIndex = comments.findIndex((comment) => comment.id === id); | ||
if (commentIndex === -1) { | ||
reject(new Error('댓글을 찾을 수 없습니다.')); | ||
return; | ||
} | ||
comments[commentIndex] = { | ||
...comments[commentIndex], | ||
text: newText, | ||
modified: true, | ||
}; | ||
resolve(comments[commentIndex]); | ||
}, 500); | ||
}); | ||
export const editComment = ( | ||
id: number, | ||
newText: string | ||
): Promise<CommentType> => { | ||
return new Promise((resolve, reject) => { | ||
setTimeout(() => { | ||
const commentIndex = comments.findIndex((comment) => comment.id === id); | ||
if (commentIndex === -1) { | ||
reject(new Error("댓글을 찾을 수 없습니다.")); | ||
return; | ||
} | ||
comments[commentIndex] = { | ||
...comments[commentIndex], | ||
text: newText, | ||
modified: true, | ||
}; | ||
resolve(comments[commentIndex]); | ||
}, 500); | ||
}); | ||
}; |