diff --git a/.eslintrc.js b/.eslintrc.js index bcdfc4e5..b1776478 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -22,6 +22,7 @@ module.exports = { 'no-undef': 0, 'prettier/prettier': 2, // Means error 'react/react-in-jsx-scope': 'off', + 'react/prop-types': 'off', // TypeScript 에서 이미 컴포넌트의 props를 검증하기 위해 타입 체크를 제공 }, settings: { react: { diff --git a/apps/react-world/src/components/Footer.tsx b/apps/react-world/src/components/Footer.tsx new file mode 100644 index 00000000..5a8d332f --- /dev/null +++ b/apps/react-world/src/components/Footer.tsx @@ -0,0 +1,16 @@ +export const Footer: React.FC = () => { + return ( + + ); +}; diff --git a/apps/react-world/src/components/Layout.tsx b/apps/react-world/src/components/Layout.tsx new file mode 100644 index 00000000..666ec697 --- /dev/null +++ b/apps/react-world/src/components/Layout.tsx @@ -0,0 +1,15 @@ +import { PropsWithChildren } from 'react'; +import { Navbar } from '../components/NavBar'; +import { Footer } from '../components/Footer'; + +type LayoutProps = PropsWithChildren; + +export const Layout = ({ children }: LayoutProps) => { + return ( + <> + + {children} + + > + ); +}; diff --git a/apps/react-world/src/components/NavBar.tsx b/apps/react-world/src/components/NavBar.tsx new file mode 100644 index 00000000..49baff27 --- /dev/null +++ b/apps/react-world/src/components/NavBar.tsx @@ -0,0 +1,28 @@ +export const Navbar: React.FC = () => { + return ( + + + + conduit + + + + + Home + + + + + Sign in + + + + + Sign up + + + + + + ); +}; diff --git a/apps/react-world/src/components/home/ArticlePreview.tsx b/apps/react-world/src/components/home/ArticlePreview.tsx new file mode 100644 index 00000000..47a36bbf --- /dev/null +++ b/apps/react-world/src/components/home/ArticlePreview.tsx @@ -0,0 +1,54 @@ +interface ArticlePreviewProps { + authorProfileLink: string; + authorProfileImageUrl: string; + authorName: string; + publishDate: string; + likeCount: number; + articleLink: string; + articleTitle: string; + articleDescription: string; + tags: string[]; +} + +const ArticlePreview: React.FC = ({ + authorProfileLink, + authorProfileImageUrl, + authorName, + publishDate, + likeCount, + articleLink, + articleTitle, + articleDescription, + tags, +}) => ( + + + + + + + + {authorName} + + {publishDate} + + + {likeCount} + + + + {articleTitle} + {articleDescription} + Read more... + + {tags.map(tag => ( + + {tag} + + ))} + + + +); + +export default ArticlePreview; diff --git a/apps/react-world/src/components/home/ArticleTagList.tsx b/apps/react-world/src/components/home/ArticleTagList.tsx new file mode 100644 index 00000000..c9acb277 --- /dev/null +++ b/apps/react-world/src/components/home/ArticleTagList.tsx @@ -0,0 +1,20 @@ +interface ArticleTagListProps { + tags: string[]; +} + +const ArticleTagList: React.FC = ({ tags }) => ( + + + Popular Tags + + {tags.map(tag => ( + + {tag} + + ))} + + + +); + +export default ArticleTagList; diff --git a/apps/react-world/src/components/home/HomeBanner.tsx b/apps/react-world/src/components/home/HomeBanner.tsx new file mode 100644 index 00000000..d3903397 --- /dev/null +++ b/apps/react-world/src/components/home/HomeBanner.tsx @@ -0,0 +1,12 @@ +export const HomeBanner: React.FC = () => { + return ( + + + + conduit + A place to share your knowledge. + + + + ); +}; diff --git a/apps/react-world/src/components/home/HomeFeedContents.tsx b/apps/react-world/src/components/home/HomeFeedContents.tsx new file mode 100644 index 00000000..4576cfe5 --- /dev/null +++ b/apps/react-world/src/components/home/HomeFeedContents.tsx @@ -0,0 +1,53 @@ +import ArticlePreview from './ArticlePreview'; +import ArticleTagList from './ArticleTagList'; +import HomeFeedTab from './HomeFeedTab'; +import Pagination from './Pagination'; + +const HomeFeedContents: React.FC = () => ( + + + + + {/* 더미 데이터 */} + + + + + + + + +); + +export default HomeFeedContents; diff --git a/apps/react-world/src/components/home/HomeFeedTab.tsx b/apps/react-world/src/components/home/HomeFeedTab.tsx new file mode 100644 index 00000000..938a720d --- /dev/null +++ b/apps/react-world/src/components/home/HomeFeedTab.tsx @@ -0,0 +1,28 @@ +interface HomeFeedTabProps { + activeFeed: 'my_feed' | 'global_feed'; +} + +const HomeFeedTab: React.FC = ({ activeFeed }) => ( + + + + + Your Feed + + + + + Global Feed + + + + +); + +export default HomeFeedTab; diff --git a/apps/react-world/src/components/home/HomePageContainer.tsx b/apps/react-world/src/components/home/HomePageContainer.tsx new file mode 100644 index 00000000..708ae22d --- /dev/null +++ b/apps/react-world/src/components/home/HomePageContainer.tsx @@ -0,0 +1,9 @@ +interface HomePageContainerProps { + children: React.ReactNode; +} + +const HomePageContainer: React.FC = ({ children }) => { + return {children}; +}; + +export default HomePageContainer; diff --git a/apps/react-world/src/components/home/Pagination.tsx b/apps/react-world/src/components/home/Pagination.tsx new file mode 100644 index 00000000..cd1d7f6f --- /dev/null +++ b/apps/react-world/src/components/home/Pagination.tsx @@ -0,0 +1,23 @@ +interface PaginationProps { + pages: number[]; + activePage: number; +} + +const Pagination: React.FC = ({ pages, activePage }) => { + return ( + + {pages.map(page => ( + + + {page} + + + ))} + + ); +}; + +export default Pagination; diff --git a/apps/react-world/src/pages/home.tsx b/apps/react-world/src/pages/home.tsx index e68f0cf5..caa0b996 100644 --- a/apps/react-world/src/pages/home.tsx +++ b/apps/react-world/src/pages/home.tsx @@ -1,185 +1,12 @@ +import HomePageContainer from '../components/home/HomePageContainer'; +import { HomeBanner } from '../components/home/HomeBanner'; +import HomeFeedContents from '../components/home/HomeFeedContents'; + export const HomePage = () => { return ( - <> - - - - conduit - - - - - Home - - - - - Sign in - - - - - Sign up - - - - - - - - - - conduit - A place to share your knowledge. - - - - - - - - - - - Your Feed - - - - - Global Feed - - - - - - - - - - - - - Eric Simons - - January 20th - - - 29 - - - - How to build webapps that scale - This is the description for the post. - Read more... - - - realworld - - - implementations - - - - - - - - - - - - - Albert Pai - - January 20th - - - 32 - - - - - The song you won't ever stop singing. No matter how - hard you try. - - This is the description for the post. - Read more... - - - realworld - - - implementations - - - - - - - - - 1 - - - - - 2 - - - - - - - - Popular Tags - - - - programming - - - javascript - - - emberjs - - - angularjs - - - react - - - mean - - - node - - - rails - - - - - - - - - - > + + + + ); }; diff --git a/apps/react-world/src/routes/Routes.tsx b/apps/react-world/src/routes/Routes.tsx index 806b9306..b6476e7e 100644 --- a/apps/react-world/src/routes/Routes.tsx +++ b/apps/react-world/src/routes/Routes.tsx @@ -1,4 +1,5 @@ import { createBrowserRouter, RouterProvider } from 'react-router-dom'; +import { Layout } from '../components/Layout'; import { HomePage } from '../pages/home'; import { LoginPage } from '../pages/login'; import { RegisterPage } from '../pages/register'; @@ -39,5 +40,9 @@ const router = createBrowserRouter([ ]); export const Routes = () => { - return ; + return ( + + ; + + ); };
{articleDescription}
Popular Tags
A place to share your knowledge.
This is the description for the post.