-
Notifications
You must be signed in to change notification settings - Fork 50
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주차 과제 step1 #21
Open
eunjin210
wants to merge
11
commits into
kakao-tech-campus-2nd-step2:eunjin210
Choose a base branch
from
eunjin210:eunjin
base: eunjin210
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
75e446c
add : Header 추가
afdd487
add : footer
b3fc3af
feat : Home banner 구현
ee42d5e
add: themeCategory
cc9ba31
add : Ranking banner`
932071d
add : Home 상품 Ranking 컴포넌트 구현
28fda1a
add : Home 상품 랭킹 컴포넌트 추가
8bb4db1
Feat: router 설정
dc66db2
add: Theme 페이지 추가
c499cf5
Feat: Login창 생성
070227c
Feat: MyAccount 기능 구현
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,24 @@ | ||
import styled from '@emotion/styled'; | ||
import { useState } from 'react'; | ||
import { BrowserRouter as Router } from 'react-router-dom'; | ||
|
||
import RoutesPage from './router/Router'; | ||
|
||
const App = () => { | ||
const name = 'Josh Perez'; | ||
const [isLoggedIn, setIsLoggedIn] = useState(false); | ||
|
||
const handleLogin = () => { | ||
setIsLoggedIn(true); | ||
}; | ||
|
||
const handleLogout = () => { | ||
setIsLoggedIn(false); | ||
}; | ||
|
||
return ( | ||
<div> | ||
<Title>Hello, {name}</Title> | ||
</div> | ||
<Router> | ||
<RoutesPage isLoggedIn={isLoggedIn} onLogin={handleLogin} onLogout={handleLogout} /> | ||
</Router> | ||
); | ||
}; | ||
|
||
export default App; | ||
|
||
const Title = styled.h1` | ||
font-size: 1.5em; | ||
color: gray; | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Layout 에서 props 로 전달받는 것 보다는 사용처에서 context 에 접근하여 로그인 상태를 가져오게끔 할 수 있을거 같습니다.
ref. https://react.dev/learn/passing-data-deeply-with-context