-
Notifications
You must be signed in to change notification settings - Fork 44
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
Part2 장성훈 week12 #406
Merged
kich555
merged 4 commits into
codeit-bootcamp-frontend:part2-장성훈
from
hoonj170214:part2-장성훈-week12
May 13, 2024
The head ref may contain hidden characters: "part2-\uC7A5\uC131\uD6C8-week12"
Merged
Part2 장성훈 week12 #406
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
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 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
File renamed without changes.
480 changes: 245 additions & 235 deletions
480
package-lock.json → ...ekly-mission-week9-main/package-lock.json
Large diffs are not rendered by default.
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,31 @@ | ||
<!DOCTYPE html> | ||
<html lang="ko"> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<title>Linkbrary</title> | ||
<meta property="og:title" content="Linkbrary" key="title" /> | ||
<meta | ||
name="description" | ||
property="og:description" | ||
content="세상의 모든 정보를 쉽게 저장하고 관리해 보세요" | ||
key="description" | ||
/> | ||
<meta | ||
property="og:image" | ||
content="https://visitbusan.net/uploadImgs/files/cntnts/20211130150754165_wufrotr" | ||
key="image" | ||
/> | ||
<meta | ||
name="viewport" | ||
content="width=device-width,minimum-scale=1,initial-scale=1,maximum-scale=1,user-scalable=no" | ||
/> | ||
<link | ||
rel="stylesheet" | ||
type="text/css" | ||
href="https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css" | ||
/> | ||
</head> | ||
<body> | ||
<div id="root"></div> | ||
</body> | ||
</html> |
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 'sharing/styles/reset.css'; | ||
import { BrowserRouter, Route, Routes } from 'react-router-dom'; | ||
import { SharedPage } from 'pages/SharedPage'; | ||
import { FolderPage } from 'pages/FolderPage'; | ||
|
||
function App() { | ||
return ( | ||
<BrowserRouter> | ||
<Routes> | ||
<Route path="/shared" element={<SharedPage />} /> | ||
<Route path="/folder" element={<FolderPage />} /> | ||
</Routes> | ||
</BrowserRouter> | ||
); | ||
} | ||
|
||
export default App; |
2 changes: 2 additions & 0 deletions
2
1-weekly-mission-week9-main/src/folder/data-access-folder/index.ts
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,2 @@ | ||
export * from "./useGetFolder"; | ||
export * from "./useGetFolders"; |
14 changes: 14 additions & 0 deletions
14
1-weekly-mission-week9-main/src/folder/data-access-folder/useGetFolder.tsx
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,14 @@ | ||
import { mapFolderData } from 'folder/util-map'; | ||
import { useAsync } from 'sharing/util'; | ||
import { axiosInstance } from 'sharing/util'; | ||
import { Folder } from 'sharing/util'; | ||
|
||
export const useGetFolder = () => { | ||
const getFolder = () => axiosInstance.get('sample/folder'); | ||
const { loading, error, data } = useAsync<Folder>(getFolder); | ||
if (data && data.hasOwnProperty('folder')) { | ||
const folderData = mapFolderData(data); | ||
|
||
return { loading, error, data: folderData }; | ||
} | ||
}; |
27 changes: 27 additions & 0 deletions
27
1-weekly-mission-week9-main/src/folder/data-access-folder/useGetFolders.tsx
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,27 @@ | ||
import { axiosInstance } from 'sharing/util'; | ||
import { useAsync } from 'sharing/util'; | ||
|
||
export interface Folders { | ||
data: { | ||
id: number; | ||
created_at: string; | ||
name: string; | ||
user_id: number; | ||
favorite: boolean; | ||
link: { | ||
count: number; | ||
}; | ||
}[]; | ||
} | ||
|
||
export const useGetFolders = () => { | ||
const getFolders = () => axiosInstance.get('users/1/folders'); | ||
const { loading, error, data } = useAsync<Folders>(getFolders); | ||
if (data) { | ||
const folders = data.data; | ||
const sortedFolders = folders.sort((a, b) => a.id - b.id); | ||
|
||
return { loading, error, data: sortedFolders }; | ||
} | ||
return; | ||
}; |
69 changes: 69 additions & 0 deletions
69
1-weekly-mission-week9-main/src/folder/feature-folder-tool-bar/FolderToolBar.module.scss
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,69 @@ | ||
@import "sharing/styles/global.scss"; | ||
|
||
.container { | ||
display: flex; | ||
flex-direction: column; | ||
align-items: flex-start; | ||
row-gap: 1.2rem; | ||
|
||
@include tablet { | ||
display: grid; | ||
grid-template-areas: | ||
"folders folders add-button" | ||
"folder-name buttons buttons"; | ||
justify-content: space-between; | ||
align-items: center; | ||
row-gap: 2.4rem; | ||
column-gap: 1.2rem; | ||
} | ||
} | ||
|
||
.folders { | ||
grid-area: folders; | ||
display: flex; | ||
flex-wrap: wrap; | ||
column-gap: 0.8rem; | ||
row-gap: 1.2rem; | ||
flex-grow: 1; | ||
} | ||
|
||
.add-button { | ||
grid-area: add-button; | ||
|
||
position: fixed; | ||
bottom: 10.1rem; | ||
left: 50%; | ||
transform: translateX(-50%); | ||
z-index: $z-index-fab; | ||
|
||
@include tablet { | ||
justify-self: flex-end; | ||
|
||
position: static; | ||
transform: none; | ||
} | ||
} | ||
|
||
.folder-name { | ||
grid-area: folder-name; | ||
margin-top: 1.6rem; | ||
font-size: 2rem; | ||
font-weight: 600; | ||
letter-spacing: -0.02rem; | ||
|
||
@include tablet { | ||
margin-top: 0; | ||
font-size: 2.4rem; | ||
} | ||
} | ||
|
||
.buttons { | ||
justify-self: flex-start; | ||
grid-area: buttons; | ||
display: flex; | ||
column-gap: 1.2rem; | ||
|
||
@include tablet { | ||
justify-self: flex-end; | ||
} | ||
} |
Oops, something went wrong.
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.
호오 hasOwnProperty 쓴거 좋습니다 ㅎ근데 위 조건일때만 값을 반환하는건 문제가 있을것 같아요
useGetFolder
는 항상 loading, error, data상태는 반환해야useGetFolder
를 사용하는 쪽에서 문제가 없을것 같습니다mapFolderData()를 꼭 사용해야만 한다면
구문은
useGetFolder
안이 아니라useGetFolder
를 선언하는 쪽에서 사용하는게 좋을것 같네요 ㅎ이렇게요!