-
Notifications
You must be signed in to change notification settings - Fork 5
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 #636 from jiphyeonjeon-42/632-feature-책-위치-보여주기
feat: 도서 위치 보여주기 및 집현전 평면도
- Loading branch information
Showing
8 changed files
with
270 additions
and
31 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,91 @@ | ||
.book-location__map { | ||
height: 100%; | ||
background-color: #f4f4f4; | ||
padding: 0 1rem 0 1rem; | ||
display: grid; | ||
grid-template-columns: repeat(4, 1fr); | ||
grid-template-rows: repeat(10, 1fr); | ||
grid-gap: 0.5rem; | ||
grid-template-areas: | ||
"cluster . . shelf-1" | ||
"cluster selfservice . shelf-1" | ||
"cluster entrance . return" | ||
"cluster sofa-1 . shelf-2" | ||
"cluster sofa-1 . shelf-2" | ||
"cluster shelf-5 . sofa-3" | ||
"cluster shelf-5 . sofa-3" | ||
"cluster sofa-2 . shelf-3" | ||
"cluster sofa-2 . shelf-3" | ||
"cluster shelf-4 shelf-4 shelf-4"; | ||
} | ||
|
||
.book-location__map > div { | ||
border-radius: 0.5rem; | ||
padding: 0.5rem; | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
font-size: 1.2rem; | ||
background-color: #e9e9e9; | ||
color: #5f3f36; | ||
} | ||
|
||
.book-location__map > .map-highlight { | ||
background-color: #736757; | ||
color: white; | ||
} | ||
|
||
.book-location__map > .map-shelf { | ||
font-weight: bold; | ||
font-size: 1.5rem; | ||
} | ||
|
||
.book-location__map > .map-selfservice { | ||
grid-area: selfservice; | ||
} | ||
|
||
.book-location__map > .map-entrance { | ||
grid-area: entrance; | ||
background-color: #f4f4f4; | ||
} | ||
|
||
.book-location__map > .map-cluster { | ||
grid-area: cluster; | ||
background-color: #f4f4f4; | ||
} | ||
|
||
.book-location__map > .map-return { | ||
grid-area: return; | ||
} | ||
|
||
.book-location__map > .map-sofa-1 { | ||
grid-area: sofa-1; | ||
} | ||
|
||
.book-location__map > .map-sofa-2 { | ||
grid-area: sofa-2; | ||
} | ||
|
||
.book-location__map > .map-sofa-3 { | ||
grid-area: sofa-3; | ||
} | ||
|
||
.book-location__map > .map-shelf-1 { | ||
grid-area: shelf-1; | ||
} | ||
|
||
.book-location__map > .map-shelf-2 { | ||
grid-area: shelf-2; | ||
} | ||
|
||
.book-location__map > .map-shelf-3 { | ||
grid-area: shelf-3; | ||
} | ||
|
||
.book-location__map > .map-shelf-4 { | ||
grid-area: shelf-4; | ||
} | ||
|
||
.book-location__map > .map-shelf-5 { | ||
grid-area: shelf-5; | ||
} |
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,28 @@ | ||
import { BookInfo } from "../../../type"; | ||
import "~/asset/css/BookLocation.css"; | ||
import "~/asset/css/BookDetail.css"; | ||
import { memo } from "react"; | ||
import { findBookShelfIndex } from "~/util/bookShelfLocation"; | ||
import BookLocationMap from "~/component/book/location/BookLocationMap"; | ||
|
||
type BookLocationProps = { | ||
bookDetailInfo: BookInfo; | ||
}; | ||
|
||
const BookLocation = memo(({ bookDetailInfo }: BookLocationProps) => { | ||
const { books } = bookDetailInfo; | ||
|
||
if (books === undefined) { | ||
return null; | ||
} | ||
|
||
const callSignFirstChar = books[0].callSign[0].at(0) ?? ""; | ||
const bookShelfIndex = findBookShelfIndex(callSignFirstChar); | ||
return ( | ||
<div className="book-detail__photo-location"> | ||
<BookLocationMap highlightIndex={bookShelfIndex} /> | ||
</div> | ||
); | ||
}); | ||
|
||
export default BookLocation; |
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 { callSignAtShelf } from "~/util/bookShelfLocation"; | ||
|
||
type Props = { | ||
highlightIndex: number; | ||
}; | ||
|
||
const BookLocationMap = ({ highlightIndex }: Props) => { | ||
const shelves = callSignAtShelf; | ||
return ( | ||
<div className="book-location__map"> | ||
<div className="map-selfservice">무인대출/반납</div> | ||
<div className="map-sofa-1">소파</div> | ||
<div className="map-sofa-2">소파</div> | ||
<div className="map-sofa-3">소파</div> | ||
<div className="map-entrance">입구</div> | ||
<div className="map-return">반납서가</div> | ||
<div className="map-cluster">5클러스터</div> | ||
{shelves.map((shelf, index) => ( | ||
<div | ||
key={index} | ||
className={`map-shelf map-shelf-${index + 1} ${ | ||
highlightIndex === index ? "map-highlight" : "" | ||
}`} | ||
> | ||
{shelf.length > 5 ? "비개발 도서" : shelf.join(" ")} | ||
</div> | ||
))} | ||
</div> | ||
); | ||
}; | ||
|
||
export default BookLocationMap; |
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 @@ | ||
type Props = { | ||
isBookLocationVisible: boolean; | ||
onToggleVisibility: () => void; | ||
}; | ||
|
||
const LocationButton = ({ | ||
isBookLocationVisible, | ||
onToggleVisibility, | ||
}: Props) => { | ||
return ( | ||
<div> | ||
<button | ||
className="location_button" | ||
type="button" | ||
onClick={onToggleVisibility} | ||
> | ||
{isBookLocationVisible ? "표지 보기" : "도서 위치"} | ||
</button> | ||
</div> | ||
); | ||
}; | ||
|
||
export default LocationButton; |
Oops, something went wrong.