Skip to content

feat: 공연 내용 더 보기 / 접기 기능 구현 #288

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 23, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions apps/admin/src/pages/ShowInfoPage/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,6 @@ const ShowInfoPage = () => {
})),
})) ?? []
}
hasNoticePage
containerRef={showPreviewRef}
/>
</Styled.ShowPreview>
Expand Down Expand Up @@ -411,9 +410,7 @@ const ShowInfoPage = () => {
userNickname: member.userNickname ?? '',
userImgPath: member.userImgPath ?? '',
})),
})) ?? []
}
hasNoticePage
})) ?? []}
containerRef={showPreviewMobileRef}
/>
</Styled.ShowInfoPreview>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import styled from '@emotion/styled'

const MarkdownContent = styled.div<{ colorMode?: 'dark' | 'light' }>`
color: ${({ colorMode, theme }) => colorMode === 'dark' ? theme.palette.mobile.grey.g30: 'inherit'};
width: 100%;
color: ${({ colorMode, theme }) => colorMode === 'dark' ? theme.palette.mobile.grey.g30 : 'inherit'};

p, ul, ol, li, blockquote {
font-size: 16px;
Expand Down
47 changes: 35 additions & 12 deletions packages/ui/src/components/ShowPreview/ShowInfoDetail.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import Styled from './ShowPreview.styles';
import { CallIcon, MessageIcon, TicketIcon } from '@boolti/icon';
import { useRef, useState, useEffect } from 'react';
import { useSwiper } from 'swiper/react';
import { showToast, checkIsWebView, TOAST_DURATIONS } from '@boolti/bridge';
import { CallIcon, ChevronDownIcon, ChevronUpIcon, MessageIcon, TicketIcon } from '@boolti/icon';

import ShowInfoDescription from '../ShowContentMarkdown';
import Styled from './ShowPreview.styles';
import PreviewMap from '../PreviewMap';
import ShowInfoDescription from '../ShowContentMarkdown';

interface Props {
show: {
Expand All @@ -19,7 +21,6 @@ interface Props {
longitude?: number;
};
soldTicketCount?: number;
hasNoticePage?: boolean;
onClickCallLink?: () => void;
onClickMessageLink?: () => void;
onClickCallLinkMobile?: () => void;
Expand All @@ -41,17 +42,36 @@ const ShowInfoDetail = ({
detailAddress,
},
soldTicketCount,
hasNoticePage,
onClickCallLink,
onClickMessageLink,
onClickCallLinkMobile,
onClickMessageLinkMobile,
onClickViewNotice,
}: Props) => {
const showNoticeRef = useRef<HTMLDivElement>(null);
const swiper = useSwiper();

const nextDay = new Date(date);
nextDay.setDate(nextDay.getDate() + 1);
const isEnded = nextDay < new Date();

const [collapse, setCollapse] = useState(true);
const [isOverflow, setIsOverflow] = useState(false);

useEffect(() => {
if (showNoticeRef.current) {
setIsOverflow(showNoticeRef.current.scrollHeight > 400);
}
}, [notice]);

useEffect(() => {
swiper?.update();
}, [collapse, swiper]);

const viewMoreClickHandler = () => {
setCollapse((prev) => !prev);
};

return (
<Styled.ShowInfo>
<Styled.ShowInfoGroup>
Expand Down Expand Up @@ -95,18 +115,21 @@ const ShowInfoDetail = ({
</Styled.ShowTicketInfoDescription>
)}
</Styled.ShowInfoGroup>
<Styled.ShowInfoGroup>
<Styled.ShowInfoGroup style={{ paddingBottom: 0 }}>
<Styled.ShowInfoTitleContainer>
<Styled.ShowInfoTitle>내용</Styled.ShowInfoTitle>
{hasNoticePage && (
<Styled.ShowInfoTitleTextButton type="button" onClick={onClickViewNotice}>
전체보기
</Styled.ShowInfoTitleTextButton>
)}
</Styled.ShowInfoTitleContainer>
<Styled.ShowInfoDescription isFullContent={hasNoticePage}>
<Styled.ShowInfoDescription collapse={collapse} ref={showNoticeRef}>
<ShowInfoDescription content={notice} />
</Styled.ShowInfoDescription>
{isOverflow && (
<Styled.ShowInfoMoreButton type="button" onClick={() => {
onClickViewNotice?.();
viewMoreClickHandler();
}}>
{collapse ? <>내용 더 보기 <ChevronDownIcon /></> : <>내용 접기 <ChevronUpIcon /></>}
</Styled.ShowInfoMoreButton>
)}
</Styled.ShowInfoGroup>
<Styled.ShowInfoGroup>
<Styled.ShowInfoTitleContainer>
Expand Down
43 changes: 29 additions & 14 deletions packages/ui/src/components/ShowPreview/ShowPreview.styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import styled from '@emotion/styled';
import { mq_lg } from '../../systems';

interface ShowInfoDescriptionProps {
isFullContent?: boolean;
collapse?: boolean;
isOverflow?: boolean;
}

const ShowPreview = styled.div`
Expand Down Expand Up @@ -200,10 +201,15 @@ const ShowInfoTitleButton = styled.button`
cursor: pointer;
`;

const ShowInfoTitleTextButton = styled.button`
height: 22px;
${({ theme }) => theme.typo.b1};
color: ${({ theme }) => theme.palette.mobile.grey.g50};
const ShowInfoMoreButton = styled.button`
display: flex;
justify-content: center;
align-items: center;
width: 100%;
padding: 10px 0 32px;
text-align: center;
${({ theme }) => theme.typo.sh1};
color: ${({ theme }) => theme.palette.mobile.grey.g10};
cursor: pointer;
`;

Expand All @@ -220,20 +226,29 @@ const ShowInfoDescription = styled.div<ShowInfoDescriptionProps>`
word-break: break-word;
display: flex;
align-items: center;
position: relative;

&:not(:last-child) {
margin-bottom: 12px;
}

${({ isFullContent }) =>
isFullContent &&
`
display: -webkit-box;
${({ collapse }) =>
collapse && `
display: block;
overflow: hidden;
text-overflow: ellipsis;
-webkit-box-orient: vertical;
-webkit-line-clamp: 10;
`}
height: 300px;

&::after {
content: '';
position: absolute;
width: 100%;
height: 40px;
bottom: 0;
left: 0;
background: linear-gradient(180deg, rgba(9, 10, 11, 0) 0%, #090A0B 100%);
}
`
}
`;

const ShowTicketInfoDescription = styled.div`
Expand Down Expand Up @@ -410,7 +425,7 @@ export default {
ShowInfoTitleContainer,
ShowInfoTitle,
ShowInfoTitleButton,
ShowInfoTitleTextButton,
ShowInfoMoreButton,
ShowInfoSubtitle,
ShowInfoDescription,
ShowTicketInfoDescription,
Expand Down
8 changes: 0 additions & 8 deletions packages/ui/src/components/ShowPreview/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ interface ShowPreviewProps {
userImgPath: string;
}[];
}>;
hasNoticePage?: boolean;
logoLinkHref?: string;
containerRef?: React.RefObject<HTMLDivElement>;
onClickLink?: () => void;
Expand All @@ -49,7 +48,6 @@ interface ShowPreviewProps {
const ShowPreview = ({
show,
showCastTeams,
hasNoticePage,
logoLinkHref,
containerRef,
onClickLink,
Expand Down Expand Up @@ -129,16 +127,10 @@ const ShowPreview = ({
content: (
<ShowInfoDetail
show={show}
hasNoticePage={hasNoticePage}
onClickCallLink={onClickLink}
onClickMessageLink={onClickLink}
onClickCallLinkMobile={onClickLinkMobile}
onClickMessageLinkMobile={onClickLinkMobile}
onClickViewNotice={() => {
containerScrollTop.current = containerRef?.current?.scrollTop ?? null;
containerRef?.current?.scrollTo(0, 0);
setNoticeOpen(true);
}}
/>
),
},
Expand Down
Loading