-
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.
Browse files
Browse the repository at this point in the history
[Design] 좌석표 구현 (좌석 선택 뷰)
- Loading branch information
Showing
13 changed files
with
189 additions
and
19 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
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,16 @@ | ||
import type { SVGProps } from 'react'; | ||
|
||
interface SvgSeatsProps extends SVGProps<SVGSVGElement> { | ||
seat: string; | ||
} | ||
|
||
const SvgBtnSeatDefaultLarge = ({ seat, ...props }: SvgSeatsProps) => ( | ||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 28 21" {...props}> | ||
<path fill="#1EAFFD" d="M0 8a8 8 0 0 1 8-8h12a8 8 0 0 1 8 8v10a3 3 0 0 1-3 3H0z" /> | ||
<path fill="#fff" d="M9 3h10v1H9z" /> | ||
<text x="50%" y="60%" dominantBaseline="middle" textAnchor="middle" fontSize="10" fill="#ffffff"> | ||
{seat} | ||
</text> | ||
</svg> | ||
); | ||
export default SvgBtnSeatDefaultLarge; |
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
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
87 changes: 87 additions & 0 deletions
87
Lotte-Cinema/src/components/seatReservation/SeatTableBody.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,87 @@ | ||
import styled from '@emotion/styled'; | ||
|
||
import { useEffect, useRef } from 'react'; | ||
|
||
import { BtnSeatDefaultLarge } from '@/assets/svg'; | ||
|
||
import { SEAT_INFO, SEAT_ROWS } from '@/constants'; | ||
|
||
const SeatTableBody = () => { | ||
const seatTableWrapperRef = useRef<HTMLDivElement>(null); | ||
|
||
useEffect(() => { | ||
const wrapper = seatTableWrapperRef.current; | ||
if (wrapper) { | ||
wrapper.scrollLeft = (wrapper.scrollWidth - wrapper.clientWidth) / 2; | ||
} | ||
}, []); | ||
|
||
return ( | ||
<S.SeatTableWrapper ref={seatTableWrapperRef}> | ||
<S.SeatTableContainer> | ||
<S.ScreenComment> | ||
<p>S</p> | ||
<p>C</p> | ||
<p>R</p> | ||
<p>E</p> | ||
<p>E</p> | ||
<p>N</p> | ||
</S.ScreenComment> | ||
<S.SeatTableBody> | ||
{SEAT_ROWS.map((row) => ( | ||
<S.SeatRowWrapper key={row}> | ||
{SEAT_INFO.filter((seat) => seat.startsWith(row)).map((seat) => ( | ||
<BtnSeatDefaultLarge | ||
key={seat} | ||
width={'2.8rem'} | ||
seat={seat} | ||
style={{ | ||
marginRight: [2, 11].includes(parseInt(seat.slice(1))) ? '2.8rem' : '0', | ||
cursor: 'pointer', | ||
}} | ||
/> | ||
))} | ||
</S.SeatRowWrapper> | ||
))} | ||
</S.SeatTableBody> | ||
</S.SeatTableContainer> | ||
</S.SeatTableWrapper> | ||
); | ||
}; | ||
|
||
export default SeatTableBody; | ||
|
||
const S = { | ||
SeatTableWrapper: styled.div` | ||
height: 100%; | ||
overflow: scroll; | ||
background-color: ${({ theme }) => theme.colors.BG_THEATER}; | ||
`, | ||
SeatTableContainer: styled.div` | ||
display: flex; | ||
flex-direction: column; | ||
width: 59rem; | ||
margin: 0 auto; | ||
background-color: ${({ theme }) => theme.colors.BG_THEATER}; | ||
`, | ||
ScreenComment: styled.div` | ||
display: flex; | ||
justify-content: center; | ||
gap: 1.4rem; | ||
margin-top: 12rem; | ||
margin-bottom: 4.4rem; | ||
${({ theme }) => theme.typographies.n_head02_reg}; | ||
background-color: ${({ theme }) => theme.colors.BG_THEATER}; | ||
color: ${({ theme }) => theme.colors.GRAY10}; | ||
`, | ||
|
||
SeatTableBody: styled.div` | ||
padding: 0rem 4rem; | ||
background-color: ${({ theme }) => theme.colors.BG_THEATER}; | ||
`, | ||
SeatRowWrapper: styled.div` | ||
display: flex; | ||
column-gap: 0.7rem; | ||
margin-bottom: 0.4rem; | ||
`, | ||
}; |
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 |
---|---|---|
@@ -1,3 +1,7 @@ | ||
|
||
import { SEAT_INFO, SEAT_ROWS } from '@/constants/seats'; | ||
|
||
import { THEATER_TABS } from './tabs'; | ||
|
||
export { THEATER_TABS }; | ||
export { THEATER_TABS, SEAT_INFO, SEAT_ROWS }; | ||
|
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,22 @@ | ||
export const SEAT_INFO: string[] = (() => { | ||
const rows = ['B', 'C', 'D', 'E', 'F', 'G'] as const; | ||
const seatsPerRow: Record<(typeof rows)[number], number> = { | ||
B: 11, | ||
C: 13, | ||
D: 13, | ||
E: 12, | ||
F: 13, | ||
G: 13, | ||
}; | ||
|
||
const seatInfo: string[] = []; | ||
rows.forEach((row) => { | ||
for (let i = 1; i <= seatsPerRow[row]; i++) { | ||
seatInfo.push(`${row}${i}`); | ||
} | ||
}); | ||
|
||
return seatInfo; | ||
})(); | ||
|
||
export const SEAT_ROWS = ['B', 'C', 'D', 'E', 'F', 'G']; |
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 |
---|---|---|
@@ -1,10 +1,12 @@ | ||
export const THEATER_TABS = [ | ||
{ | ||
id: 1, | ||
name: '일반관', | ||
}, | ||
{ | ||
id: 2, | ||
name: '스페셜관', | ||
}, | ||
|
||
{ | ||
id: 1, | ||
name: '일반관', | ||
}, | ||
{ | ||
id: 2, | ||
name: '스페셜관', | ||
}, | ||
|
||
]; |
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