Skip to content

Commit

Permalink
chore: lint
Browse files Browse the repository at this point in the history
  • Loading branch information
kim1387 committed Sep 21, 2024
1 parent 7cd8881 commit 4c32eb3
Show file tree
Hide file tree
Showing 6 changed files with 100 additions and 95 deletions.
44 changes: 23 additions & 21 deletions frontend/src/App.css
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;
}
10 changes: 5 additions & 5 deletions frontend/src/components/Navbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ function Navbar() {
};

/*
마이 페이지로 이동 ('/mypage/:id') - p2
const moveToMyPage = () => {
navigate(`/mypage/${user.id}`);
};
*/
마이 페이지로 이동 ('/mypage/:id') - p2
const moveToMyPage = () => {
navigate(`/mypage/${user.id}`);
};
*/

return (
<div className="flex flex-row justify-center items-center w-full h-12 bg-white">
Expand Down
1 change: 1 addition & 0 deletions frontend/src/components/comment/Comment.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ interface CommentProps extends CommentType {
onDelete: (id: number) => void;
onEdit: (id: number, newText: string) => void;
}

function Comment({
id,
text,
Expand Down
23 changes: 11 additions & 12 deletions frontend/src/index.css
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;
}
14 changes: 7 additions & 7 deletions frontend/src/main.tsx
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>
);
103 changes: 53 additions & 50 deletions frontend/src/mockApi.ts
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);
});
};

0 comments on commit 4c32eb3

Please sign in to comment.