Skip to content

Commit

Permalink
Merge pull request #7 from marina-yhm/test
Browse files Browse the repository at this point in the history
Feat: Header 기능구현
  • Loading branch information
marinesnow34 authored Nov 13, 2023
2 parents b54708c + 65c1f75 commit ca2e59b
Show file tree
Hide file tree
Showing 26 changed files with 87 additions and 28 deletions.
14 changes: 7 additions & 7 deletions src/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -39,35 +39,35 @@

@font-face {
font-family: "Bold";
src: url("./assets/font/Pretendard-Bold.otf");
src: url("/src/assets/font/Pretendard-Bold.woff2");
}

@font-face {
font-family: "ExtraBold";
src: url("./assets/font/Pretendard-ExtraBold.otf");
src: url("/src/assets/font/Pretendard-ExtraBold.woff2");
}

@font-face {
font-family: "ExtraLight";
src: url("./assets/font/Pretendard-ExtraLight.otf");
src: url("/src/assets/font/Pretendard-ExtraLight.woff2");
}

@font-face {
font-family: "Light";
src: url("./assets/font/Pretendard-Light.otf");
src: url("/src/assets/font/Pretendard-Light.woff2");
}

@font-face {
font-family: "Medium";
src: url("./assets/font/Pretendard-Medium.otf");
src: url("/src/assets/font/Pretendard-Medium.woff2");
}

@font-face {
font-family: "Regular";
src: url("./assets/font/Pretendard-Regular.otf");
src: url("/src/assets/font/Pretendard-Regular.woff2");
}

@font-face {
font-family: "SemiBold";
src: url("./assets/font/Pretendard-SemiBold.otf");
src: url("/src/assets/font/Pretendard-SemiBold.woff2");
}
20 changes: 12 additions & 8 deletions src/App.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Route, Routes } from "react-router-dom";
import { RecoilRoot } from "recoil";
import Header from "../src/components/views/Header/Header";
import Inventory from "../src/pages/Inventory/Inventory";
import Mypage from "../src/pages/Mypage/Mypage";
Expand All @@ -9,15 +10,18 @@ import Home from "./pages/Home/Home";
function App() {
return (
<div className="App">
<Header />
<Routes>
<Route path="/" element={<Home />} />
<Route path="/Inventory" element={<Inventory />} />
<Route path="/Sales" element={<Sales />} />
<Route path="/Mypage" element={<Mypage />} />
</Routes>
<RecoilRoot>
<Header />

{/* <Footer /> */}
<Routes>
<Route path="/" element={<Home />} />
<Route path="/Inventory" element={<Inventory />} />
<Route path="/Sales" element={<Sales />} />
<Route path="/Mypage" element={<Mypage />} />
</Routes>

{/* <Footer /> */}
</RecoilRoot>
</div>
);
}
Expand Down
6 changes: 2 additions & 4 deletions src/Atom/status.jsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import { atom } from "recoil";

const storeStatus = atom({
key: "storeStatus", // 전역적으로 고유한 값
export const storeState = atom({
key: "storeState", // 전역적으로 고유한 값
default: false, // 초깃값
});

export default storeStatus;
Binary file removed src/assets/font/Pretendard-Black.otf
Binary file not shown.
Binary file added src/assets/font/Pretendard-Black.woff2
Binary file not shown.
Binary file removed src/assets/font/Pretendard-Bold.otf
Binary file not shown.
Binary file added src/assets/font/Pretendard-Bold.woff2
Binary file not shown.
Binary file removed src/assets/font/Pretendard-ExtraBold.otf
Binary file not shown.
Binary file added src/assets/font/Pretendard-ExtraBold.woff2
Binary file not shown.
Binary file removed src/assets/font/Pretendard-ExtraLight.otf
Binary file not shown.
Binary file added src/assets/font/Pretendard-ExtraLight.woff2
Binary file not shown.
Binary file removed src/assets/font/Pretendard-Light.otf
Binary file not shown.
Binary file added src/assets/font/Pretendard-Light.woff2
Binary file not shown.
Binary file removed src/assets/font/Pretendard-Medium.otf
Binary file not shown.
Binary file added src/assets/font/Pretendard-Medium.woff2
Binary file not shown.
Binary file removed src/assets/font/Pretendard-Regular.otf
Binary file not shown.
Binary file added src/assets/font/Pretendard-Regular.woff2
Binary file not shown.
Binary file removed src/assets/font/Pretendard-SemiBold.otf
Binary file not shown.
Binary file added src/assets/font/Pretendard-SemiBold.woff2
Binary file not shown.
Binary file removed src/assets/font/Pretendard-Thin.otf
Binary file not shown.
Binary file added src/assets/font/Pretendard-Thin.woff2
Binary file not shown.
23 changes: 23 additions & 0 deletions src/components/views/Header/Header.css
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,26 @@
margin-top: 1.25rem;
float: left;
}

.store-group {
display: flex;
flex-direction: row;
object-fit: contain;
align-items: center;
}

.font {
color: #fff;
font-family: Pretendard;
font-size: 1.875rem;
font-style: normal;
font-weight: 600;
line-height: 100%; /* 1.875rem */
}

.head-container {
display: flex;
align-content: stretch;
flex-wrap: wrap;
justify-content: space-evenly;
}
35 changes: 33 additions & 2 deletions src/components/views/Header/Header.jsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,47 @@
import React from "react";
import React, { useState } from "react";
import { Col, Row } from "react-bootstrap";
import { useRecoilValue } from "recoil";
import { storeState } from "../../../Atom/status";
import StoreOff from "../../../assets/icons/Header/CloseLight.svg"; //영업종료
import LOGO from "../../../assets/icons/Header/LOGO.svg"; //로고
import StoreOn from "../../../assets/icons/Header/OpenLight.svg"; //영업중
import SoundOff from "../../../assets/icons/Header/SoundOff.svg"; //소리끔
import SoundOn from "../../../assets/icons/Header/SoundOn.svg"; //소리켬
import "./Header.css";

const Header = () => {
const Store = useRecoilValue(storeState);
const [Sound, setSound] = useState(1);

const onClickHandler = (e) => {
setSound(!Sound);
};

return (
<div className="header">
<Row>
<Col>
<img src={LOGO} className="LOGO" alt="LOGO" />
</Col>
<Col></Col>
<Col />
<Col className="head-container">
{!Store ? (
<div className="store-group">
<img src={StoreOn} alt="Open" />
<div className="font">영업중</div>
</div>
) : (
<div className="store-group">
<img src={StoreOff} alt="Close" />
<div className="font">영업종료 </div>
</div>
)}
{Sound ? (
<img src={SoundOn} onClick={onClickHandler} alt="SoundOn" />
) : (
<img src={SoundOff} onClick={onClickHandler} alt="SoundOff" />
)}
</Col>
</Row>
</div>
);
Expand Down
13 changes: 8 additions & 5 deletions src/components/views/NavBar/NavBar.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import "bootstrap/dist/css/bootstrap.min.css";
import React, { useState } from "react";
import React from "react";
import { Nav } from "react-bootstrap";
import { useRecoilCallback, useRecoilState } from "recoil";
import { storeState } from "../../../Atom/status";
import Home from "../../../assets/icons/Navbar/Home.svg"; //홈
import Inven from "../../../assets/icons/Navbar/Inven.svg"; //재고관리
import Mypage from "../../../assets/icons/Navbar/Mypage.svg"; //마이페이지
Expand All @@ -11,11 +13,12 @@ import "../NavBar/NavBar.css";
const NavBar = () => {
const currentPath = window.location.pathname; // 현재 경로 가져오기

const [Store, setStore] = useState(1); // 영업여부
const [Store] = useRecoilState(storeState); // 영업여부
const setStoreState = useRecoilCallback(({ set }) => async () => {
set(storeState, !Store);
});
const onClickHandler = (e) => {
setStore((prevStore) => {
setStore(!prevStore);
});
setStoreState();
};

return (
Expand Down
2 changes: 1 addition & 1 deletion src/pages/Mypage/MainMypage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import React from "react";
const MainMypage = () => {
return (
<div>
<h1>MainMypage</h1>
<h1>Mypage</h1>
</div>
);
};
Expand Down
2 changes: 1 addition & 1 deletion src/pages/Sales/MainSales.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import React from "react";
const MainSales = () => {
return (
<div>
<h1>MainSales</h1>
<h1>Sales</h1>
</div>
);
};
Expand Down

0 comments on commit ca2e59b

Please sign in to comment.