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#1] refactor - WishBookSummaryCard 컴포넌트로 분리
- Loading branch information
1 parent
aa59e11
commit a9d5f83
Showing
4 changed files
with
141 additions
and
24 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import RentHistoryItem from "../atoms/RentHistoryItem"; | ||
import {Button, Row} from "react-bootstrap"; | ||
import * as React from "react"; | ||
import {IWishBook} from "../../pages/dashboard"; | ||
|
||
interface IProps { | ||
wishBook: IWishBook; | ||
} | ||
|
||
const WishBookSummaryElement = ({wishBook}: IProps) => { | ||
const buyLinkButtonHandler = (buyLink: string) => () => { | ||
const newWindow = window.open(buyLink, '_blank') | ||
newWindow.focus(); | ||
}; | ||
|
||
const enrollButtonHandler = (id: string) => () => { | ||
console.log(id, '등록 되었습니다.'); | ||
}; | ||
|
||
return ( | ||
<Row> | ||
<RentHistoryItem sm={4}>{wishBook.title}</RentHistoryItem> | ||
<RentHistoryItem sm={3}>{wishBook.createTime}</RentHistoryItem> | ||
<RentHistoryItem sm={3}>{wishBook.userName}</RentHistoryItem> | ||
<RentHistoryItem sm={1}> | ||
<Button variant="dark" onClick={buyLinkButtonHandler(wishBook.buyLink)}>구매</Button> | ||
</RentHistoryItem> | ||
<RentHistoryItem sm={1}> | ||
<Button variant="dark" onClick={enrollButtonHandler(wishBook.id)}>등록</Button> | ||
</RentHistoryItem> | ||
</Row> | ||
); | ||
}; | ||
|
||
export default WishBookSummaryElement; |
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,29 @@ | ||
import {Card, ListGroup} from "react-bootstrap"; | ||
import WishBookSummaryElement from "../molecules/WishBookSummaryElement"; | ||
import * as React from "react"; | ||
import {IWishBook} from "../../pages/dashboard"; | ||
|
||
interface IProps { | ||
wishBooks: IWishBook[]; | ||
} | ||
|
||
const WishBookSummaryCardBody = ({wishBooks}: IProps) => ( | ||
<div style={{overflow: 'scroll'}}> | ||
<ListGroup variant="flush"> | ||
{wishBooks.map((wishBook: IWishBook, i: number) => ( | ||
<ListGroup.Item key={i}> | ||
<WishBookSummaryElement wishBook={wishBook}/> | ||
</ListGroup.Item> | ||
))} | ||
</ListGroup> | ||
</div> | ||
); | ||
|
||
const WishBookSummaryCard = ({wishBooks}: IProps) => ( | ||
<Card style={{width: '100%', maxHeight: '435px'}}> | ||
<Card.Header as="h5">희망도서</Card.Header> | ||
<WishBookSummaryCardBody wishBooks={wishBooks}/> | ||
</Card> | ||
); | ||
|
||
export default WishBookSummaryCard; |
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