-
Notifications
You must be signed in to change notification settings - Fork 0
[4주차 기본/심화/공유 과제] 회원가입 & 로그인 구현 #5
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
Open
KIMGEONHWI
wants to merge
18
commits into
main
Choose a base branch
from
week4_assignment
base: main
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
18 commits
Select commit
Hold shift + click to select a range
a6416e7
init: 초기 프로젝트 생성
KIMGEONHWI cd5a1f8
chore: 라우터 설정
KIMGEONHWI 45925fd
chore: theme, 글로벌 스타일 설정
KIMGEONHWI 56ff2d4
style: outlet 스타일링
KIMGEONHWI e27219e
style: login 페이지 퍼블리싱
KIMGEONHWI 54452dc
style: 로그인 버튼 hove시 transition 적용
KIMGEONHWI cb04575
style: 회원가입 페이지 퍼블리싱
KIMGEONHWI 618e1f7
feat: 회원가입 페이지 비밀번호 로직 구현
KIMGEONHWI 52e4ef8
feat: 회원가입 페이지 취미 로직 구현
KIMGEONHWI f5e70a6
feat: 회원가입 페이지 퍼널 구조 구현
KIMGEONHWI 3fb3ae2
feat: 회원가입, 로그인 api 연결
KIMGEONHWI abccece
style: 마이 페이지 퍼블리싱
KIMGEONHWI af80fac
feat: 마이페이지 내 취미 조회, 다른 사람 취미 조회 api 연결
KIMGEONHWI 663bda2
feat: 회원 정보 수정 api 연결
KIMGEONHWI 126ab76
refactor: 라우터 디폴트 path 수정
KIMGEONHWI a2433e3
refactor: Login 페이지 네이밍 변경
KIMGEONHWI 17ab2ce
refactor: 불필요한 부분 삭제
KIMGEONHWI 669822a
refactor: MyPage 컴포넌트 분리
KIMGEONHWI 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
This file contains hidden or 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,26 @@ | ||
| # Logs | ||
| logs | ||
| *.log | ||
| npm-debug.log* | ||
| yarn-debug.log* | ||
| yarn-error.log* | ||
| pnpm-debug.log* | ||
| lerna-debug.log* | ||
|
|
||
| node_modules | ||
| dist | ||
| dist-ssr | ||
| *.local | ||
|
|
||
| # Editor directories and files | ||
| .vscode/* | ||
| !.vscode/extensions.json | ||
| .idea | ||
| .DS_Store | ||
| *.suo | ||
| *.ntvs* | ||
| *.njsproj | ||
| *.sln | ||
| *.sw? | ||
|
|
||
| .env |
This file contains hidden or 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,50 @@ | ||
| # React + TypeScript + Vite | ||
|
|
||
| This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules. | ||
|
|
||
| Currently, two official plugins are available: | ||
|
|
||
| - [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react/README.md) uses [Babel](https://babeljs.io/) for Fast Refresh | ||
| - [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh | ||
|
|
||
| ## Expanding the ESLint configuration | ||
|
|
||
| If you are developing a production application, we recommend updating the configuration to enable type aware lint rules: | ||
|
|
||
| - Configure the top-level `parserOptions` property like this: | ||
|
|
||
| ```js | ||
| export default tseslint.config({ | ||
| languageOptions: { | ||
| // other options... | ||
| parserOptions: { | ||
| project: ['./tsconfig.node.json', './tsconfig.app.json'], | ||
| tsconfigRootDir: import.meta.dirname, | ||
| }, | ||
| }, | ||
| }) | ||
| ``` | ||
|
|
||
| - Replace `tseslint.configs.recommended` to `tseslint.configs.recommendedTypeChecked` or `tseslint.configs.strictTypeChecked` | ||
| - Optionally add `...tseslint.configs.stylisticTypeChecked` | ||
| - Install [eslint-plugin-react](https://github.com/jsx-eslint/eslint-plugin-react) and update the config: | ||
|
|
||
| ```js | ||
| // eslint.config.js | ||
| import react from 'eslint-plugin-react' | ||
|
|
||
| export default tseslint.config({ | ||
| // Set the react version | ||
| settings: { react: { version: '18.3' } }, | ||
| plugins: { | ||
| // Add the react plugin | ||
| react, | ||
| }, | ||
| rules: { | ||
| // other rules... | ||
| // Enable its recommended rules | ||
| ...react.configs.recommended.rules, | ||
| ...react.configs['jsx-runtime'].rules, | ||
| }, | ||
| }) | ||
| ``` |
This file contains hidden or 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,28 @@ | ||
| import js from '@eslint/js' | ||
| import globals from 'globals' | ||
| import reactHooks from 'eslint-plugin-react-hooks' | ||
| import reactRefresh from 'eslint-plugin-react-refresh' | ||
| import tseslint from 'typescript-eslint' | ||
|
|
||
| export default tseslint.config( | ||
| { ignores: ['dist'] }, | ||
| { | ||
| extends: [js.configs.recommended, ...tseslint.configs.recommended], | ||
| files: ['**/*.{ts,tsx}'], | ||
| languageOptions: { | ||
| ecmaVersion: 2020, | ||
| globals: globals.browser, | ||
| }, | ||
| plugins: { | ||
| 'react-hooks': reactHooks, | ||
| 'react-refresh': reactRefresh, | ||
| }, | ||
| rules: { | ||
| ...reactHooks.configs.recommended.rules, | ||
| 'react-refresh/only-export-components': [ | ||
| 'warn', | ||
| { allowConstantExport: true }, | ||
| ], | ||
| }, | ||
| }, | ||
| ) |
This file contains hidden or 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,13 @@ | ||
| <!DOCTYPE html> | ||
| <html lang="ko"> | ||
| <head> | ||
| <meta charset="UTF-8" /> | ||
| <link rel="icon" type="image/svg+xml" href="/vite.svg" /> | ||
| <meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
| <title>API통신</title> | ||
| </head> | ||
| <body> | ||
| <div id="root"></div> | ||
| <script type="module" src="/src/main.tsx"></script> | ||
| </body> | ||
| </html> |
This file contains hidden or 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,33 @@ | ||
| { | ||
| "name": "week4_assignment", | ||
| "private": true, | ||
| "version": "0.0.0", | ||
| "type": "module", | ||
| "scripts": { | ||
| "dev": "vite", | ||
| "build": "tsc -b && vite build", | ||
| "lint": "eslint .", | ||
| "preview": "vite preview" | ||
| }, | ||
| "dependencies": { | ||
| "axios": "^1.7.7", | ||
| "react": "^18.3.1", | ||
| "react-dom": "^18.3.1", | ||
| "react-router-dom": "^6.28.0", | ||
| "styled-components": "^6.1.13" | ||
| }, | ||
| "devDependencies": { | ||
| "@eslint/js": "^9.13.0", | ||
| "@types/react": "^18.3.12", | ||
| "@types/react-dom": "^18.3.1", | ||
| "@types/react-router-dom": "^5.3.3", | ||
| "@vitejs/plugin-react-swc": "^3.5.0", | ||
| "eslint": "^9.13.0", | ||
| "eslint-plugin-react-hooks": "^5.0.0", | ||
| "eslint-plugin-react-refresh": "^0.4.14", | ||
| "globals": "^15.11.0", | ||
| "typescript": "~5.6.2", | ||
| "typescript-eslint": "^8.11.0", | ||
| "vite": "^5.4.10" | ||
| } | ||
| } |
This file contains hidden or 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,16 @@ | ||
| import { RouterProvider } from "react-router-dom"; | ||
| import { router } from "./Router"; | ||
| import GlobalStyle from "./styles/GlobalStyle"; | ||
| import { ThemeProvider } from "styled-components"; | ||
| import theme from "./styles/\btheme"; | ||
|
|
||
| const App = () => { | ||
| return ( | ||
| <ThemeProvider theme={theme}> | ||
| <GlobalStyle /> | ||
| <RouterProvider router={router} /> | ||
| </ThemeProvider> | ||
| ); | ||
| }; | ||
|
|
||
| export default App; |
This file contains hidden or 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 { Outlet } from "react-router-dom"; | ||
| import styled from "styled-components"; | ||
|
|
||
| const Roots = () => { | ||
| return ( | ||
| <OutletContainer> | ||
| <Outlet /> | ||
| </OutletContainer> | ||
| ); | ||
| }; | ||
|
|
||
| export default Roots; | ||
|
|
||
| const OutletContainer = styled.main` | ||
| width: 100%; | ||
| height: 100dvh; | ||
| display: flex; | ||
| justify-content: center; | ||
|
|
||
| background: ${({ theme }) => theme.colors.orange7}; | ||
| `; |
This file contains hidden or 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,30 @@ | ||
| import { createBrowserRouter } from "react-router-dom"; | ||
| import LoginPage from "./pages/LoginPage/LoginPage"; | ||
| import SignUpPage from "./pages/SignUpPage/SignUpPage"; | ||
| import MyPage from "./pages/Mypage/MyPage"; | ||
| import Roots from "./Roots"; | ||
|
|
||
| export const router = createBrowserRouter([ | ||
| { | ||
| path: "/", | ||
| element: <Roots />, | ||
| children: [ | ||
| { | ||
| index: true, | ||
| element: <LoginPage />, | ||
| }, | ||
| { | ||
| path: "/login", | ||
| element: <LoginPage />, | ||
| }, | ||
| { | ||
| path: "/signup", | ||
| element: <SignUpPage />, | ||
| }, | ||
| { | ||
| path: "/mypage", | ||
| element: <MyPage />, | ||
| }, | ||
| ], | ||
| }, | ||
| ]); |
This file contains hidden or 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,84 @@ | ||
| import styled from "styled-components"; | ||
| import { useNavigate } from "react-router-dom"; | ||
|
|
||
| interface HeaderProps { | ||
| activeTab: string; | ||
| setActiveTab: (tab: string) => void; | ||
| } | ||
|
|
||
| const Header = ({ activeTab, setActiveTab }: HeaderProps) => { | ||
| const navigate = useNavigate(); | ||
|
|
||
| const handleLogout = () => { | ||
| localStorage.removeItem("authToken"); | ||
| navigate("/login"); | ||
| }; | ||
|
|
||
| return ( | ||
| <HeaderContainer> | ||
| <HeaderRight> | ||
| <Title>마이페이지</Title> | ||
| <Nav> | ||
| <NavItem | ||
| active={activeTab === "hobby"} | ||
| onClick={() => setActiveTab("hobby")} | ||
| > | ||
| 취미 | ||
| </NavItem> | ||
| <NavItem | ||
| active={activeTab === "info"} | ||
| onClick={() => setActiveTab("info")} | ||
| > | ||
| 내 정보 | ||
| </NavItem> | ||
| </Nav> | ||
| </HeaderRight> | ||
| <LogoutButton onClick={handleLogout}>로그아웃</LogoutButton> | ||
| </HeaderContainer> | ||
| ); | ||
| }; | ||
|
|
||
| export default Header; | ||
|
|
||
| const HeaderContainer = styled.header` | ||
| width: 100%; | ||
| padding: 1rem 2rem; | ||
| background: ${({ theme }) => theme.colors.bookmark_click}; | ||
| display: flex; | ||
| align-items: center; | ||
| justify-content: space-between; | ||
| color: ${({ theme }) => theme.colors.white1}; | ||
| `; | ||
|
|
||
| const HeaderRight = styled.div` | ||
| display: flex; | ||
| gap: 5rem; | ||
| `; | ||
|
|
||
| const Title = styled.h1` | ||
| font-size: 1.5rem; | ||
| font-weight: 700; | ||
| `; | ||
|
|
||
| const Nav = styled.nav` | ||
| display: flex; | ||
| gap: 1.5rem; | ||
| `; | ||
|
|
||
| const NavItem = styled.span<{ active: boolean }>` | ||
| font-size: 1.2rem; | ||
| cursor: pointer; | ||
| color: ${({ active }) => (active ? "white" : "#ddd")}; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. p4: 저는 active 상태에 따라 다른 색을 보여주고 싶을때, inactive, active로 이름을 붙여서 사용하는 편인데 참고해주셔도 좋을것 같아요! 여기 하나는 #ddd로 색상이 정의되어있어서 제안드립니다 ㅎㅎ |
||
| font-weight: ${({ active }) => (active ? "bold" : "normal")}; | ||
| `; | ||
|
|
||
| const LogoutButton = styled.button` | ||
| display: flex; | ||
| width: 5rem; | ||
| height: 2rem; | ||
| font-size: 1rem; | ||
| background: none; | ||
| border: none; | ||
| color: ${({ theme }) => theme.colors.white1}; | ||
| cursor: pointer; | ||
| `; | ||
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.
p5: 저는 취미랑 정보페이지를 따로 만들어서 이동하게 했는데, 이렇게도 구현할 수 있었네요. 배워갑니다!