Skip to content

Commit

Permalink
Merge pull request #698 from woowacourse-teams/feature/#697
Browse files Browse the repository at this point in the history
룰렛 채팅 페이지 당첨자 배너 UI 개발
  • Loading branch information
jaeml06 authored Oct 23, 2024
2 parents 0e2b6d9 + e9ab4b4 commit 13206e2
Show file tree
Hide file tree
Showing 8 changed files with 123 additions and 36 deletions.
Binary file not shown.
Binary file not shown.
8 changes: 8 additions & 0 deletions frontend/src/common/font.style.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import pretendardMediumWoff2 from './assets/fonts/woff2-subset/Pretendard-Medium
import pretendardRegularWoff2 from './assets/fonts/woff2-subset/Pretendard-Regular.subset.woff2';
import pretendardSemiboldWoff2 from './assets/fonts/woff2-subset/Pretendard-SemiBold.subset.woff2';
import pretendardThinWoff2 from './assets/fonts/woff2-subset/Pretendard-Thin.subset.woff2';
import partialSansKRRegular from './assets/fonts/PartialSansKR/PartialSansKR-Regular.woff2';

const fonts = css`
@font-face {
Expand Down Expand Up @@ -75,6 +76,13 @@ const fonts = css`
font-display: swap;
src: url(${pretendardThinWoff2}) format('woff2');
}
@font-face {
font-family: PartialSansKR;
font-weight: 400;
font-display: swap;
src: url(${partialSansKRRegular}) format('woff2');
}
`;

export default fonts;
2 changes: 2 additions & 0 deletions frontend/src/common/theme/theme.type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export interface Typography {
small: SerializedStyles;
Tiny: SerializedStyles;
tag: SerializedStyles;
partialSansKR: SerializedStyles;
}

export interface ColoredTypography {
Expand All @@ -66,6 +67,7 @@ export interface ColoredTypography {
small: (fontColor: string | SerializedStyles) => SerializedStyles;
Tiny: (fontColor: string | SerializedStyles) => SerializedStyles;
tag: (fontColor: string | SerializedStyles) => SerializedStyles;
partialSansKR: (fontColor: string | SerializedStyles) => SerializedStyles;
}
export interface Layout {
default: SerializedStyles;
Expand Down
52 changes: 29 additions & 23 deletions frontend/src/common/theme/typography.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,173 +5,179 @@ const typography: Typography = {
h1: css`
font-family: Pretendard;
font-size: 4.8rem;
font-style: normal;
font-weight: 700;
font-style: normal;
line-height: 5.8rem;
`,
h2: css`
font-family: Pretendard;
font-size: 4rem;
font-style: normal;
font-weight: 700;
font-style: normal;
line-height: 4.8rem;
`,
h3: css`
font-family: Pretendard;
font-size: 3.2rem;
font-style: normal;
font-weight: 700;
font-style: normal;
line-height: 3.8rem;
`,
h4: css`
font-family: Pretendard;
font-size: 2.8rem;
font-style: normal;
font-weight: 700;
font-style: normal;
line-height: 3.4rem;
`,
h5: css`
font-family: Pretendard;
font-size: 2.4rem;
font-style: normal;
font-weight: 700;
font-style: normal;
line-height: 2.8rem;
`,

s1: css`
font-family: Pretendard;
font-size: 1.8rem;
font-style: normal;
font-weight: 700;
font-style: normal;
line-height: 2.8rem;
`,
s2: css`
font-family: Pretendard;
font-size: 1.6rem;
font-style: normal;
font-weight: 700;
font-style: normal;
line-height: 2.4rem;
`,

b1: css`
font-family: Pretendard;
font-size: 1.6rem;
font-style: normal;
font-weight: 500;
font-style: normal;
line-height: 2.4rem;
`,
b2: css`
font-family: Pretendard;
font-size: 1.6rem;
font-style: normal;
font-weight: 400;
font-style: normal;
line-height: 2.4rem;
`,
b3: css`
font-family: Pretendard;
font-size: 1.4rem;
font-style: normal;
font-weight: 500;
font-style: normal;
line-height: 2rem;
`,
b4: css`
font-family: Pretendard;
font-size: 1.4rem;
font-style: normal;
font-weight: 400;
font-style: normal;
line-height: 2rem;
`,

c1: css`
font-family: Pretendard;
font-size: 1.2rem;
font-style: normal;
font-weight: 700;
font-style: normal;
line-height: 1.6rem;
`,
c2: css`
font-family: Pretendard;
font-size: 1.2rem;
font-style: normal;
font-weight: 400;
font-style: normal;
line-height: 1.6rem;
`,
c3: css`
font-family: Pretendard;
font-size: 1rem;
font-style: normal;
font-weight: 400;
font-style: normal;
line-height: 1.4rem;
`,

label: css`
font-family: Pretendard;
font-size: 1.2rem;
font-style: normal;
font-weight: 700;
font-style: normal;
line-height: 1.6rem;
text-transform: uppercase;
`,

ButtonFont: css`
font-family: Inter;
font-size: 2.4rem;
font-style: normal;
font-weight: 600;
font-style: normal;
line-height: 2.8rem;
`,

Typeface: css`
font-family: Inter;
font-size: 1.6rem;
font-style: normal;
font-weight: 400;
font-style: normal;
line-height: 2.4rem;
`,

Giant: css`
font-family: Pretendard;
font-size: 1.8rem;
font-style: normal;
font-weight: 700;
font-style: normal;
line-height: 2.4rem;
`,

Large: css`
font-family: Pretendard;
font-size: 1.6rem;
font-style: normal;
font-weight: 700;
font-style: normal;
line-height: 2rem;
`,
Medium: css`
font-family: Pretendard;
font-size: 1.4rem;
font-style: normal;
font-weight: 700;
font-style: normal;
line-height: 1.6rem;
`,
small: css`
font-family: Pretendard;
font-size: 1.2rem;
font-style: normal;
font-weight: 700;
font-style: normal;
line-height: 1.6rem;
`,
Tiny: css`
font-family: Pretendard;
font-size: 1rem;
font-style: normal;
font-weight: 800;
font-style: normal;
line-height: 1.2rem;
`,
tag: css`
font-family: Pretendard;
font-size: 1.2rem;
font-style: normal;
font-weight: 600;
font-style: normal;
line-height: 130%;
`,
partialSansKR: css`
font-family: PartialSansKR;
font-size: 2rem;
font-weight: 400;
font-style: normal;
`,
};

export default typography;
29 changes: 16 additions & 13 deletions frontend/src/pages/Chatting/ChattingRoomPage/ChattingRoomPage.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { css, useTheme } from '@emotion/react';
import { isBetChatRoomDetail, isMoimChatRoomDetail } from '@_types/typeGuards';
import { useMemo, useState } from 'react';
import { Fragment, useMemo, useState } from 'react';
import { useNavigate, useParams } from 'react-router-dom';

import CalenderClock from '@_components/Icons/CalenderClock';
Expand All @@ -26,6 +26,7 @@ import useChats from '@_hooks/queries/useChats';
import useConfirmDateTime from '@_hooks/mutaions/useConfirmDatetime';
import useConfirmPlace from '@_hooks/mutaions/useConfirmPlace';
import useSendMessage from '@_hooks/mutaions/useSendMessage';
import LooserBanner from './components/LooserBanner/LooserBanner';

type ModalContent = 'place' | 'datetime';

Expand Down Expand Up @@ -202,18 +203,20 @@ export default function ChattingRoomPage() {
/>
)}
{chatRoomDetail && isBetChatRoomDetail(chatRoomDetail) && (
<ChatInfoAccordion
tagTheme={chatRoomDetail.attributes.isLoser ? 'yellow' : 'orange'}
tagValue={chatRoomDetail.attributes.isLoser ? '당첨!' : '미당첨'}
textList={
chatRoomDetail.attributes.isLoser
? ['당첨입니다!', '혹시 안내셨나요?ㅋ']
: [
'살아남았습니다!',
`당첨된 사람은 ${chatRoomDetail.attributes.loser.nickname}입니다!`,
]
}
/>
<Fragment>
<ChatInfoAccordion
tagTheme={chatRoomDetail.attributes.isLoser ? 'yellow' : 'orange'}
tagValue={chatRoomDetail.attributes.isLoser ? '당첨!' : '미당첨'}
textList={
chatRoomDetail.attributes.isLoser
? ['축하드립니다!']
: [
`당첨된 사람은 ${chatRoomDetail.attributes.loser.nickname}님입니다!`,
]
}
/>
<LooserBanner chatRoomDetail={chatRoomDetail} />
</Fragment>
)}
</ChattingRoomLayout.HeaderBottom>
<ChatList chats={chats} />
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import { css, Theme } from '@emotion/react';

export const bannerContainer = ({ theme }: { theme: Theme }) => css`
overflow: hidden; /* 텍스트가 벗어나면 숨김 */
display: flex;
align-items: center;
width: 100%;
height: 4.4rem;
padding-bottom: 0.4rem;
background-color: ${theme.colorPalette.black[100]};
`;

export const bannerTextContainer = css`
display: flex; /* 텍스트가 가로로 나란히 배치되도록 설정 */
white-space: nowrap; /* 텍스트가 한 줄로 유지되도록 설정 */
`;

export const bannerText = ({ theme }: { theme: Theme }) => css`
display: inline-block;
font-size: 2rem;
color: ${theme.colorPalette.white[100]};
${theme.typography.partialSansKR}
animation: marquee 3s linear infinite; /* 애니메이션 설정 */
@keyframes marquee {
0% {
transform: translateX(0); /* 처음 상태 */
}
100% {
transform: translateX(-100%); /* 왼쪽 끝으로 이동 */
}
}
`;
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { BetChatRoomDetail } from '@_types/index';
import { useTheme } from '@emotion/react';
import * as S from './LooserBanner.style';

interface LooserBannerProps {
chatRoomDetail: BetChatRoomDetail;
}

export default function LooserBanner(props: LooserBannerProps) {
const { chatRoomDetail } = props;

const theme = useTheme();

return (
<div css={S.bannerContainer({ theme })}>
<div css={S.bannerTextContainer}>
<span css={S.bannerText({ theme })}>
축하드립니다 {chatRoomDetail.attributes.loser.nickname}님!&nbsp;
</span>
<span css={S.bannerText({ theme })}>
축하드립니다 {chatRoomDetail.attributes.loser.nickname}님!&nbsp;
</span>
<span css={S.bannerText({ theme })}>
축하드립니다 {chatRoomDetail.attributes.loser.nickname}님!&nbsp;
</span>
<span css={S.bannerText({ theme })}>
축하드립니다 {chatRoomDetail.attributes.loser.nickname}님!&nbsp;
</span>
</div>
</div>
);
}

0 comments on commit 13206e2

Please sign in to comment.