-
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.
feat: implement concert name search in open bus rental
- Loading branch information
Showing
19 changed files
with
574 additions
and
18 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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
export * from './refundAccountApi'; | ||
export * from './rentalApi'; | ||
export * from './surveyApi'; | ||
export * from './rentalFormAPI'; |
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 { endPoint } from 'constants/endPoint'; | ||
import type { SearchConcertResponse } from 'types'; | ||
import { publicAxios } from 'utils'; | ||
|
||
// 공연 검색 | ||
export const requestGetSearchConcert = async (query: string) => { | ||
return ( | ||
await publicAxios.get<SearchConcertResponse>( | ||
`${endPoint.GET_CONCERT_SEARCH_LIST}?query=${query}` | ||
) | ||
).data.result; | ||
}; |
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
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
119 changes: 119 additions & 0 deletions
119
src/pages/openBusRental/components/items/SearchConcertItem.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,119 @@ | ||
import styled from '@emotion/styled'; | ||
import { LuCalendar } from 'react-icons/lu'; | ||
import { PiMapPinFill } from 'react-icons/pi'; | ||
|
||
import { BodyMediumText, CaptionText } from 'styles/Typography'; | ||
import type { ConcertData } from 'types'; | ||
import { formatDateRange } from 'utils'; | ||
|
||
interface SearchConcertItemProps { | ||
concertData: ConcertData; | ||
isInactive?: boolean; | ||
onClick?: (concertData: ConcertData) => void; | ||
} | ||
|
||
const ConcertTitle = styled(BodyMediumText)` | ||
display: -webkit-box; | ||
-webkit-line-clamp: 2; | ||
-webkit-box-orient: vertical; | ||
overflow: hidden; | ||
text-overflow: ellipsis; | ||
margin-bottom: 1.2rem; | ||
`; | ||
|
||
const ConcertItemContainer = styled.div<{ isInactive?: boolean }>` | ||
display: flex; | ||
align-items: stretch; | ||
gap: 1.6rem; | ||
width: 100%; | ||
height: fit-content; | ||
padding: 1.2rem 0; | ||
pointer-events: ${({ isInactive }) => (isInactive ? 'none' : 'auto')}; | ||
cursor: pointer; | ||
&:hover, | ||
&:active { | ||
${ConcertTitle} { | ||
color: ${({ theme }) => theme.colors.dark[100]}; | ||
text-decoration: underline; | ||
} | ||
} | ||
`; | ||
|
||
const ConcertPoster = styled.div` | ||
flex-shrink: 0; | ||
position: relative; | ||
width: 7.5rem; | ||
height: 10rem; | ||
`; | ||
|
||
const PosterImg = styled.img` | ||
width: 100%; | ||
height: 100%; | ||
border-radius: 4px; | ||
object-fit: cover; | ||
`; | ||
|
||
const ConcertContent = styled.div` | ||
display: flex; | ||
flex-direction: column; | ||
`; | ||
|
||
const ConcertHall = styled.div` | ||
display: flex; | ||
align-items: center; | ||
gap: 0.8rem; | ||
margin-top: auto; | ||
margin-bottom: 0.4rem; | ||
svg { | ||
flex-shrink: 0; | ||
} | ||
`; | ||
|
||
const ConcertHallName = styled(CaptionText)` | ||
display: -webkit-box; | ||
-webkit-line-clamp: 1; | ||
-webkit-box-orient: vertical; | ||
overflow: hidden; | ||
text-overflow: ellipsis; | ||
`; | ||
|
||
const Date = styled.div` | ||
display: flex; | ||
align-items: center; | ||
gap: 0.8rem; | ||
svg { | ||
flex-shrink: 0; | ||
} | ||
`; | ||
|
||
const SearchConcertItem = ({ concertData, isInactive, onClick }: SearchConcertItemProps) => { | ||
const { poster, title, concertHallName, stDate, edDate } = concertData; | ||
|
||
const handleConcertClick = () => { | ||
if (onClick) onClick(concertData); | ||
}; | ||
|
||
return ( | ||
<ConcertItemContainer isInactive={isInactive} onClick={handleConcertClick}> | ||
<ConcertPoster> | ||
<PosterImg alt="Rental Thumbnail" src={poster} /> | ||
</ConcertPoster> | ||
<ConcertContent> | ||
<ConcertTitle>{title}</ConcertTitle> | ||
<ConcertHall> | ||
<PiMapPinFill size={16} /> | ||
<ConcertHallName>{concertHallName}</ConcertHallName> | ||
</ConcertHall> | ||
<Date> | ||
<LuCalendar size={16} /> | ||
<CaptionText>{formatDateRange(stDate, edDate)}</CaptionText> | ||
</Date> | ||
</ConcertContent> | ||
</ConcertItemContainer> | ||
); | ||
}; | ||
|
||
export default SearchConcertItem; |
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
Oops, something went wrong.