Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
143 changes: 138 additions & 5 deletions react/my-react-app/package-lock.json

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

3 changes: 2 additions & 1 deletion react/my-react-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
},
"dependencies": {
"react": "^19.1.0",
"react-dom": "^19.1.0"
"react-dom": "^19.1.0",
"styled-components": "^6.1.18"
Copy link
Collaborator

Choose a reason for hiding this comment

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

무슨 일인지, react-router-dom이 커밋에서 빠져있습니다.. 😿

},
"devDependencies": {
"@eslint/js": "^9.25.0",
Expand Down
42 changes: 0 additions & 42 deletions react/my-react-app/src/App.css

This file was deleted.

27 changes: 22 additions & 5 deletions react/my-react-app/src/App.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from "react";
import { BrowserRouter, Routes, Route } from "react-router-dom";
import { BrowserRouter, Routes, Route, useLocation } from "react-router-dom";
import Header from "./components/Header";
import Footer from "./components/Footer";
import HomePage from "./pages/HomePage";
Expand All @@ -11,10 +11,19 @@ import PrivacyPage from "./pages/PrivacyPage";
import FaqPage from "./pages/FaqPage";
import MyProfilePage from "./pages/MyProfilePage";

function App() {
function AppContent() {
const location = useLocation();
const hideFooterRoutes = ["/additem", "/signin", "/signup"];
Copy link
Collaborator

Choose a reason for hiding this comment

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

const hideHeaderRoutes = ["/signin", "/signup"];

// 현재 라우트에 따라 헤더 표시 여부 결정
const shouldShowHeader = !hideHeaderRoutes.includes(location.pathname);
// 현재 라우트에 따라 푸터 표시 여부 결정
const shouldShowFooter = !hideFooterRoutes.includes(location.pathname);

return (
<BrowserRouter>
<Header />
<>
{shouldShowHeader && <Header />}
<Routes>
<Route path="/" element={<HomePage />} />
<Route path="/signin" element={<SigninPage />} />
Expand All @@ -25,7 +34,15 @@ function App() {
<Route path="/faq" element={<FaqPage />} />
<Route path="/myprofile" element={<MyProfilePage />} />
</Routes>
<Footer />
{shouldShowFooter && <Footer />}
</>
);
}

function App() {
return (
<BrowserRouter>
<AppContent />
</BrowserRouter>
);
}
Expand Down
Loading
Loading