
File name
Commit message
Commit date
File name
Commit message
Commit date
File name
Commit message
Commit date
/**
* @author : 최정우
* @since : 2022.09.20
* @dscription : React를 활용한 Client단 구현 대상인 Application의 시작점(Index) Component 입니다.
*/
import React, { useEffect, useState } from "react";
import { useLocation } from "react-router-dom";
import AppRoute from "./AppRoute.jsx";
import Header from "../layout/Header.jsx";
import Menu from "../layout/Menu.jsx";
function App() {
const [currentPathName, setCurrentPathName] = useState("");
const location = useLocation();
useEffect(() => {
const body = document.querySelector("body");
if (location.pathname === "/") {
body.style.backgroundColor = "#f9f9f9";
setCurrentPathName("홈");
} else if (location.pathname === "/search") {
body.style.backgroundColor = "#ffffff";
setCurrentPathName("조회");
} else if (location.pathname === "/homeInsert") {
body.style.backgroundColor = "#ffffff";
setCurrentPathName("업체 등록");
} else if (location.pathname === "/homeSelectOne") {
body.style.backgroundColor = "#ffffff";
setCurrentPathName("영업 일지");
} else if (location.pathname === "/custinfo") {
body.style.backgroundColor = "#ffffff";
setCurrentPathName("업체 정보 조회");
}
}, [location.pathname]);
return (
<div id="App" className="mobile-layout">
<Header pathName={currentPathName}></Header>
<Menu></Menu>
<div id="pages">
<AppRoute />
</div>
</div>
);
}
export default App;