This repository has been archived by the owner on Mar 29, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11 from TheDevLuffy/feature/ZENHUB-3
[#3] 장서 관리 페이지 생성
- Loading branch information
Showing
17 changed files
with
309 additions
and
36 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
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,15 @@ | ||
import * as React from "react"; | ||
|
||
interface IProps { | ||
title: string; | ||
children: string; | ||
} | ||
|
||
const BookDetailRow = ({title, children}: IProps) => ( | ||
<div style={{display: 'flex', flexDirection: 'row', fontSize: '18px', padding: '4px'}}> | ||
<div style={{flex: 2, textAlign: 'center', fontWeight: 'bold'}}>{title}</div> | ||
<div style={{flex: 10}}>{children}</div> | ||
</div> | ||
); | ||
|
||
export default BookDetailRow; |
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 {Badge} from "react-bootstrap"; | ||
import * as React from "react"; | ||
|
||
const BookRentStatusBadge = ({rentStatus}: any) => ( | ||
<div style={{fontSize: '24px', lineHeight: '24px'}}> | ||
{rentStatus | ||
? <Badge variant="warning">대여중</Badge> | ||
: <Badge variant="success">비치중</Badge>} | ||
</div> | ||
); | ||
|
||
export default BookRentStatusBadge; |
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,26 @@ | ||
import {ILibraryBook} from "../../models/interfaces"; | ||
import {Image} from "react-bootstrap"; | ||
import BookDetailRow from "../atoms/BookDetailRow"; | ||
import * as React from "react"; | ||
|
||
|
||
interface IProps { | ||
libraryBook: ILibraryBook; | ||
} | ||
|
||
const BookDetailCardBody = ({libraryBook}: IProps) => ( | ||
<div style={{display: 'flex', flexDirection: 'row'}}> | ||
<div style={{flex: 2, minHeight: '250px', maxHeight: '250px'}}> | ||
<Image src={libraryBook ? libraryBook.image : null} fluid style={{width: '100%', height: '100%'}}/> | ||
</div> | ||
<div style={{flex: 9, padding: '12px', display: 'flex', flexDirection: 'column'}}> | ||
<BookDetailRow title="제목">{libraryBook ? libraryBook.title : ''}</BookDetailRow> | ||
<BookDetailRow title="저자">{libraryBook ? libraryBook.author : ''}</BookDetailRow> | ||
<BookDetailRow title="출판사">{libraryBook ? libraryBook.publisher : ''}</BookDetailRow> | ||
<BookDetailRow title="ISBN">{libraryBook ? libraryBook.isbn : ''}</BookDetailRow> | ||
<BookDetailRow title="상세정보">{libraryBook ? libraryBook.description : ''}</BookDetailRow> | ||
</div> | ||
</div> | ||
); | ||
|
||
export default BookDetailCardBody; |
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
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,32 @@ | ||
import {ISerialInfo} from "../../models/interfaces"; | ||
import BookSerialElement from "./BookSerialElement"; | ||
import * as React from "react"; | ||
import {CSSProperties} from "react"; | ||
|
||
interface IProps { | ||
serials: ISerialInfo[] | ||
} | ||
|
||
const style: CSSProperties = { | ||
display: 'flex', | ||
flexDirection: 'column', | ||
minHeight: '250px', | ||
maxHeight: '350px', | ||
height: 'fill-content', | ||
textAlign: 'center', | ||
overflow: 'scroll' | ||
}; | ||
|
||
const BookRentListCardBody = ({serials}: IProps) => ( | ||
<div style={style}> | ||
{serials.map((serial: ISerialInfo, i: number) => ( | ||
<BookSerialElement | ||
key={i} | ||
serialNumber={serial.serialNumber} | ||
rentStatus={serial.rentStatus} | ||
rentUser={serial.rentUser}/> | ||
))} | ||
</div> | ||
); | ||
|
||
export default BookRentListCardBody; |
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,45 @@ | ||
import * as React from "react"; | ||
import BookRentStatusBadge from "../atoms/BookRentStatusBadge"; | ||
import {Button} from "react-bootstrap"; | ||
import Divider from "../atoms/Divider"; | ||
import {CSSProperties} from "react"; | ||
|
||
interface IProps { | ||
serialNumber: number; | ||
rentStatus: boolean; | ||
rentUser: string; | ||
} | ||
|
||
const itemStyle: CSSProperties = { | ||
flex: 1, | ||
padding: '4px', | ||
display: 'flex', | ||
flexDirection: 'column', | ||
justifyContent: 'center' | ||
}; | ||
|
||
const BookSerialElement = ({serialNumber, rentStatus, rentUser}: IProps) => ( | ||
<div> | ||
<div style={{height: '50px', display: 'flex', flexDirection: 'row', padding: '4px'}}> | ||
<div style={itemStyle}> | ||
<div>{serialNumber}</div> | ||
</div> | ||
<div style={{flex: 2, padding: '4px', display: 'flex', flexDirection: 'column', justifyContent: 'center'}}> | ||
<BookRentStatusBadge rentStatus={rentStatus}/> | ||
</div> | ||
<div style={itemStyle}> | ||
<div>{rentUser ? rentUser : ''}</div> | ||
</div> | ||
<div style={itemStyle}> | ||
<div style={{display: 'flex', flexDirection: 'row', justifyContent: 'center'}}> | ||
<Button variant="primary" size="sm" style={{width: '71.25px'}} disabled={!rentStatus}>반납 요청</Button> | ||
<div style={{width: '16px'}}/> | ||
<Button variant="primary" size="sm" style={{width: '71.25px'}}>삭제</Button> | ||
</div> | ||
</div> | ||
</div> | ||
<Divider/> | ||
</div> | ||
); | ||
|
||
export default BookSerialElement; |
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 {Button, Card} from "react-bootstrap"; | ||
import * as React from "react"; | ||
|
||
interface IProps { | ||
title: string; | ||
buttonName: string; | ||
buttonOnClick?: any; | ||
disabled?: boolean; | ||
} | ||
|
||
const CardButtonHeader = ({title, buttonName, buttonOnClick, disabled}: IProps) => ( | ||
<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'}}>{title}</div> | ||
</div> | ||
<div style={{flex: 1, display: 'flex', flexDirection: 'column'}}> | ||
<Button variant="primary" size="sm" onClick={buttonOnClick} | ||
disabled={disabled ? disabled : false}>{buttonName}</Button> | ||
</div> | ||
</div> | ||
</Card.Header> | ||
); | ||
|
||
export default CardButtonHeader; |
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,18 @@ | ||
import {ILibraryBook} from "../../models/interfaces"; | ||
import {Card} from "react-bootstrap"; | ||
import CardButtonHeader from "../molecules/CardButtonHeader"; | ||
import BookDetailCardBody from "../molecules/BookDetailCardBody"; | ||
import * as React from "react"; | ||
|
||
interface IProps { | ||
libraryBook: ILibraryBook; | ||
} | ||
|
||
const BookDetailCard = ({libraryBook}: IProps) => ( | ||
<Card> | ||
<CardButtonHeader title="장서 상세 정보" buttonName="정보 수정" disabled={true}/> | ||
<BookDetailCardBody libraryBook={libraryBook}/> | ||
</Card> | ||
); | ||
|
||
export default BookDetailCard; |
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 BookListPageContext from "../../contexts/BookListPageContext"; | ||
import BookListPageButtons from "../molecules/BookListPageButtons"; | ||
import * as React from "react"; | ||
|
||
|
||
const BookListCardFooter = ({page, onPageDown, onPageUp}) => ( | ||
<BookListPageContext.Provider value={{page, onPageDown, onPageUp}}> | ||
<BookListPageButtons/> | ||
</BookListPageContext.Provider> | ||
); | ||
|
||
export default BookListCardFooter; |
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,48 @@ | ||
import {Card} from "react-bootstrap"; | ||
import CardButtonHeader from "../molecules/CardButtonHeader"; | ||
import BookRentListCardBody from "../molecules/BookRentListCardBody"; | ||
import * as React from "react"; | ||
import {ISerialInfo} from "../../models/interfaces"; | ||
import {useState} from "react"; | ||
import BookListCardFooter from "./BookListCardFooter"; | ||
import Divider from "../atoms/Divider"; | ||
|
||
interface IProps { | ||
bookId: string | string[]; | ||
onClick?: any; | ||
} | ||
|
||
const mockSerials: ISerialInfo[] = [ | ||
{serialNumber: 1, rentStatus: true, rentUser: '루피'}, | ||
{serialNumber: 2, rentStatus: false, rentUser: null}, | ||
{serialNumber: 3, rentStatus: true, rentUser: '루피'}, | ||
]; | ||
|
||
const BookRentListCard = ({bookId, onClick}: IProps) => { | ||
|
||
const [page, setPage] = useState(1); | ||
const [serials, setSerials] = useState<ISerialInfo[]>(mockSerials); | ||
|
||
const onPageDown = () => { | ||
if (page <= 1) { | ||
return; | ||
} | ||
setPage(page - 1); | ||
console.log('on Page Down'); | ||
}; | ||
|
||
const onPageUp = () => { | ||
console.log('on page up'); | ||
}; | ||
|
||
return ( | ||
<Card style={{marginTop: '20px'}}> | ||
<CardButtonHeader title="시리얼 정보" buttonName="추가" buttonOnClick={onClick}/> | ||
<BookRentListCardBody serials={serials}/> | ||
<Divider/> | ||
<BookListCardFooter page={page} onPageDown={onPageDown} onPageUp={onPageUp}/> | ||
</Card> | ||
); | ||
}; | ||
|
||
export default BookRentListCard; |
Oops, something went wrong.