forked from milzipmoza-developers/tecobrary-admin-client-v2
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[milzipmoza-developers#3] feat - 책 조회 페이지 컴포넌트 기반으로 리팩토링
- Loading branch information
1 parent
2ac59d9
commit d9701bf
Showing
9 changed files
with
210 additions
and
14 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import * as React from "react"; | ||
import AppBarContainer from "../../src/components/organisms/containers/AppBarContainer"; | ||
import ContentContainer from "../../src/components/organisms/containers/ContentContainer"; | ||
import {Card} from "react-bootstrap"; | ||
import {useRouter} from "next/router"; | ||
|
||
const Index = () => { | ||
const router = useRouter(); | ||
const {id} = router.query; | ||
|
||
return ( | ||
<AppBarContainer isLoggedIn={true}> | ||
<ContentContainer> | ||
<Card> | ||
<Card.Header as="h5">장서 상세 정보</Card.Header> | ||
조회 할 책 id - {id} | ||
</Card> | ||
</ContentContainer> | ||
</AppBarContainer> | ||
); | ||
}; | ||
|
||
export default Index; |
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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import * as React from "react"; | ||
|
||
const Divider = () => ( | ||
<div style={{backgroundColor: '#DFDFDF', height: '1px'}}/> | ||
); | ||
|
||
export default Divider; |
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,28 @@ | ||
import {useRouter} from "next/router"; | ||
import {Button, Card} from "react-bootstrap"; | ||
import * as React from "react"; | ||
|
||
const LibraryBookCardHeader = () => { | ||
const router = useRouter(); | ||
|
||
const enrollButtonClickHandler = () => { | ||
router.push("/books/create"); | ||
}; | ||
|
||
return ( | ||
<Card.Header as="h5"> | ||
<div style={{display: 'flex', flexDirection: 'row'}}> | ||
<div style={{flex: 13, display: 'flex', flexDirection: 'column', justifyContent: 'center'}}> | ||
<div style={{width: 'fit-content'}}> | ||
장서 목록 | ||
</div> | ||
</div> | ||
<div style={{flex: 1}}> | ||
<Button variant="primary" size="sm" onClick={enrollButtonClickHandler}>새 책 등록</Button> | ||
</div> | ||
</div> | ||
</Card.Header> | ||
); | ||
}; | ||
|
||
export default LibraryBookCardHeader; |
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 LibraryBookPageContext from "../../contexts/LibraryBookPageContext"; | ||
import {Button, ButtonGroup} from "react-bootstrap"; | ||
import * as React from "react"; | ||
|
||
const LibraryBookPageButtons = () => { | ||
return ( | ||
<LibraryBookPageContext.Consumer> | ||
{({page, onPageDown, onPageUp}) => ( | ||
<div style={{height: '40px', display: 'flex', flexDirection: 'row', justifyContent: 'center'}}> | ||
<ButtonGroup aria-label="Basic example"> | ||
<Button variant="primary" onClick={onPageDown}>이전</Button> | ||
<Button disabled>{page}</Button> | ||
<Button variant="primary" onClick={onPageUp}>다음</Button> | ||
</ButtonGroup> | ||
</div> | ||
)} | ||
</LibraryBookPageContext.Consumer> | ||
) | ||
}; | ||
|
||
export default LibraryBookPageButtons; |
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,20 @@ | ||
import {ListGroup} from "react-bootstrap"; | ||
import {ILibraryBook} from "../../models/interfaces"; | ||
import LibraryBookElement from "../molecules/LibraryBookElement"; | ||
import * as React from "react"; | ||
import "./mouseover.css"; | ||
|
||
const LibraryBookCardBody = ({books, onClick}) => ( | ||
<div style={{overflow: 'scroll'}}> | ||
<ListGroup variant="flush" style={{height: '700px'}}> | ||
{books.map((libraryBook: ILibraryBook, i: number) => ( | ||
<ListGroup.Item className="library-book-item" | ||
key={i} style={{height: '150px', cursor: 'pointer'}} | ||
onClick={onClick(libraryBook.id)}> | ||
<LibraryBookElement libraryBook={libraryBook}/> | ||
</ListGroup.Item>))} | ||
</ListGroup> | ||
</div> | ||
); | ||
|
||
export default LibraryBookCardBody; |
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,12 @@ | ||
import LibraryBookPageContext from "../../contexts/LibraryBookPageContext"; | ||
import LibraryBookPageButtons from "../molecules/LibraryBookPageButtons"; | ||
import * as React from "react"; | ||
|
||
|
||
const LibraryBookCardFooter = ({page, onPageDown, onPageUp}) => ( | ||
<LibraryBookPageContext.Provider value={{page, onPageDown, onPageUp}}> | ||
<LibraryBookPageButtons/> | ||
</LibraryBookPageContext.Provider> | ||
); | ||
|
||
export default LibraryBookCardFooter; |
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,4 @@ | ||
.library-book-item:hover { | ||
box-shadow: 4px 3px 10px 0 rgba(0, 0, 0, 0.5); | ||
z-index: 10000; | ||
} |
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,13 @@ | ||
import * as React from "react"; | ||
|
||
const LibraryBookPageContext = React.createContext({ | ||
page: 1, | ||
onPageDown: () => { | ||
|
||
}, | ||
onPageUp: () => { | ||
|
||
}, | ||
}); | ||
|
||
export default LibraryBookPageContext; |