Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

전남대_FE_이은진 2주차 과제 step2 #34

Open
wants to merge 13 commits into
base: eunjin210
Choose a base branch
from
65 changes: 52 additions & 13 deletions package-lock.json

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

9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,11 @@
"dependencies": {
"@emotion/react": "^11.11.3",
"@emotion/styled": "^11.11.0",
"react": "^18.2.0",
"react-dom": "^18.2.0"
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-router-dom": "^6.24.1"
},
"devDependencies": {
"react-scripts": "5.0.1",
"typescript": "^4.9.5",
"@craco/craco": "^7.1.0",
"@emotion/eslint-plugin": "^11.11.0",
"@storybook/addon-essentials": "^7.6.17",
Expand Down Expand Up @@ -65,8 +64,10 @@
"eslint-plugin-storybook": "^0.8.0",
"prettier": "^3.2.5",
"prop-types": "^15.8.1",
"react-scripts": "5.0.1",
"storybook": "^7.6.17",
"tsconfig-paths-webpack-plugin": "^4.1.0",
"typescript": "^4.9.5",
"webpack": "^5.90.3"
},
"overrides": {
Expand Down
21 changes: 10 additions & 11 deletions src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
import styled from '@emotion/styled';
import React from 'react';
import { BrowserRouter as Router } from 'react-router-dom';

const App = () => {
const name = 'Josh Perez';
import { AuthProvider } from './context/AuthContext';
import RoutesPage from './router/Router';

const App: React.FC = () => {
return (
<div>
<Title>Hello, {name}</Title>
</div>
<AuthProvider>
<Router>
<RoutesPage />
</Router>
</AuthProvider>
);
};

export default App;

const Title = styled.h1`
font-size: 1.5em;
color: gray;
`;
25 changes: 25 additions & 0 deletions src/Layout/Footer/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import styled from '@emotion/styled';
import React from 'react';

export const Footer: React.FC = () => {
return (
<Wrapper>
<Content>카카오톡 선물하기</Content>
</Wrapper>
);
};

export default Footer;

const Wrapper = styled.footer`
padding: 28px 16px 88px;
width: 80%;
margin: 0 auto;
max-width: 100vw;
background-color: #fafafc;
`;

const Content = styled.p`
font-size: 20px;
font-weight: bold;
`;
54 changes: 54 additions & 0 deletions src/Layout/Header/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import styled from '@emotion/styled';
import React from 'react';
import { useNavigate } from 'react-router-dom';

interface HeaderProps {
isLoggedIn: boolean;
}

const Header: React.FC<HeaderProps> = ({ isLoggedIn }) => {
const navigate = useNavigate();

const handleLoginClick = () => {
navigate('/login');
};

const handleAccountClick = () => {
navigate('/my-account');
};

return (
<HeaderWrapper>
<Title>선물하기</Title>
{isLoggedIn ? (
<Button onClick={handleAccountClick}>내 계정</Button>
) : (
<Button onClick={handleLoginClick}>로그인</Button>
)}
</HeaderWrapper>
);
};

export default Header;

const HeaderWrapper = styled.header`
display: flex;
width: 80%;
margin: 0 auto;
justify-content: space-between;
align-items: center;
padding: 16px;
background-color: #ffffff;
`;

const Title = styled.h1`
font-size: 30px;
font-weight: bold;
`;

const Button = styled.button`
background: none;
border: none;
font-size: 16px;
cursor: pointer;
`;
21 changes: 21 additions & 0 deletions src/Layout/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import React from 'react';
import { Outlet } from 'react-router-dom';

import Footer from '@/Layout/Footer';
import Header from '@/Layout/Header';

interface LayoutProps {
isLoggedIn: boolean;
}

const Layout: React.FC<LayoutProps> = ({ isLoggedIn }) => {
return (
<div>
<Header isLoggedIn={isLoggedIn} />
<Outlet />
<Footer />
</div>
);
};

export default Layout;
17 changes: 17 additions & 0 deletions src/Pages/Home/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import AiReference from "@/components/common/HomeComponents/AiReference";
import Banner from "@/components/common/HomeComponents/Banner";
import Ranking from "@/components/common/HomeComponents/Ranking";
import ThemeCategory from "@/components/common/HomeComponents/ThemeCategory";

export const Home = () => {
return(
<>
<Banner></Banner>
<ThemeCategory></ThemeCategory>
<AiReference></AiReference>
<Ranking></Ranking>
</>
)
}

export default Home
Loading