-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
21 changed files
with
607 additions
and
60 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
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,21 @@ | ||
import { styled } from 'styled-components'; | ||
|
||
const CardContainer = styled.div` | ||
display: flex; | ||
flex-direction: column; | ||
background-color: ${({ theme }) => theme.colors.navy2_60}; | ||
backdrop-filter: blur(1.5px); | ||
border-radius: 10px; | ||
`; | ||
|
||
const CardFooter = styled.div` | ||
display: flex; | ||
align-items: center; | ||
justify-content: space-between; | ||
padding: 9px 22px; | ||
background-color: rgb(100 81 155 / 60%); | ||
border-bottom-right-radius: 10px; | ||
border-bottom-left-radius: 10px; | ||
`; | ||
|
||
export { CardContainer, CardFooter }; |
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,95 @@ | ||
import React from 'react'; | ||
import { useNavigate } from 'react-router-dom'; | ||
|
||
import CommentChip from '@components/commons/Chip/CommentChip'; | ||
import { Col, Row } from '@components/commons/Flex/Flex'; | ||
import Text from '@components/commons/Text/Text'; | ||
import { TopicResponse } from '@interfaces/api/topic'; | ||
|
||
import { colors } from '@styles/theme'; | ||
|
||
import { getDateDiff } from '@utils/date'; | ||
|
||
import { CardContainer, CardFooter } from './BTopicCard.styles'; | ||
import BTopicChoice from './BTopicChoice'; | ||
|
||
interface BTopicCardProps { | ||
topic: TopicResponse; | ||
} | ||
|
||
const BTopicCard = ({ topic }: BTopicCardProps) => { | ||
const navigate = useNavigate(); | ||
|
||
const handleCardClick = () => { | ||
navigate(`/topics/b/${topic.topicId}`, { state: { topic } }); | ||
}; | ||
|
||
return ( | ||
<> | ||
<CardContainer onClick={handleCardClick}> | ||
<Col padding={'12px 22px 20px'}> | ||
<Row justifyContent={'space-between'} alignItems={'center'} style={{ marginBottom: 2 }}> | ||
<Row gap={10}> | ||
<Text size={13} color={colors.purple}> | ||
{topic.keyword?.keywordName} | ||
</Text> | ||
<Text size={13} color={colors.white_40}> | ||
{getDateDiff(topic.createdAt)} 전 | ||
</Text> | ||
</Row> | ||
{topic.selectedOption && ( | ||
<Text | ||
size={13} | ||
weight={600} | ||
color={colors.purple} | ||
noWrap | ||
style={{ | ||
borderRadius: 30, | ||
padding: '2px 12px', | ||
backgroundColor: colors.purple_30, | ||
}} | ||
> | ||
선택완료 | ||
</Text> | ||
)} | ||
</Row> | ||
<Row justifyContent={'space-between'} alignItems={'center'} style={{ marginBottom: 17 }}> | ||
<Text size={18} weight={600} color={colors.white}> | ||
{topic.topicTitle} | ||
</Text> | ||
<button>-</button> | ||
</Row> | ||
<Row gap={5}> | ||
<BTopicChoice | ||
side={topic.choices[0].choiceOption} | ||
content={topic.choices[0].content.text || ''} | ||
/> | ||
<BTopicChoice | ||
side={topic.choices[1].choiceOption} | ||
content={topic.choices[1].content.text || ''} | ||
/> | ||
</Row> | ||
</Col> | ||
<CardFooter> | ||
<Row gap={5}> | ||
<Text size={13} weight={600} color={colors.white_80}> | ||
선택 | ||
</Text> | ||
<Text size={13} weight={600} color={colors.white_40}> | ||
{topic.voteCount.toLocaleString()} 명 | ||
</Text> | ||
</Row> | ||
<CommentChip | ||
count={topic.commentCount} | ||
backgroundColor={colors.black_20} | ||
onClick={function (): void { | ||
throw new Error('Function not implemented.'); | ||
}} | ||
/> | ||
</CardFooter> | ||
</CardContainer> | ||
</> | ||
); | ||
}; | ||
|
||
export default BTopicCard; |
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,43 @@ | ||
import React from 'react'; | ||
import styled from 'styled-components'; | ||
|
||
import Text from '@components/commons/Text/Text'; | ||
|
||
import { colors } from '@styles/theme'; | ||
|
||
interface BTopicChoiceProps { | ||
side: 'CHOICE_A' | 'CHOICE_B'; | ||
content: string; | ||
} | ||
|
||
const BTopicChoice = ({ side, content }: BTopicChoiceProps) => { | ||
return ( | ||
<ChoiceContainer> | ||
<Text size={13} weight={600} color={colors.white_40} align={'center'}> | ||
{content} | ||
</Text> | ||
<Text | ||
size={20} | ||
weight={900} | ||
color={side === 'CHOICE_A' ? colors.A_60 : colors.B_60} | ||
style={{ position: 'absolute', top: 0, left: 6 }} | ||
> | ||
{side === 'CHOICE_A' ? 'A' : 'B'} | ||
</Text> | ||
</ChoiceContainer> | ||
); | ||
}; | ||
|
||
const ChoiceContainer = styled.div` | ||
position: relative; | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
width: 100%; | ||
height: 72px; | ||
padding: 0 20px; | ||
background-color: ${({ theme }) => theme.colors.navy2}; | ||
border-radius: 10px; | ||
`; | ||
|
||
export default BTopicChoice; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import React from 'react'; | ||
import { useNavigate } from 'react-router-dom'; | ||
import { styled } from 'styled-components'; | ||
|
||
import { colors } from '@styles/theme'; | ||
|
||
import { RightChevronIcon } from '@icons/index'; | ||
|
||
interface BackButtonProps { | ||
onClick?: () => void; | ||
} | ||
|
||
const BackButton = ({ onClick }: BackButtonProps) => { | ||
const navigate = useNavigate(); | ||
|
||
const handleBackButtonClick = () => { | ||
navigate(-1); | ||
}; | ||
|
||
return ( | ||
<Button onClick={onClick ? onClick : handleBackButtonClick}> | ||
<RightChevronIcon style={{ transform: 'rotate(180deg)' }} stroke={colors.white} /> | ||
</Button> | ||
); | ||
}; | ||
|
||
const Button = styled.button` | ||
display: flex; | ||
align-items: center; | ||
width: 24px; | ||
height: 24px; | ||
padding: 5px; | ||
cursor: pointer; | ||
`; | ||
|
||
export default BackButton; |
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,35 @@ | ||
import React from 'react'; | ||
|
||
import { zIndex, colors } from '@styles/theme'; | ||
|
||
import { ALogoIcon, BLogoIcon } from '@icons/index'; | ||
|
||
import { Row } from '../Flex/Flex'; | ||
|
||
const Loading = () => { | ||
return ( | ||
<div | ||
className="loading" | ||
style={{ | ||
position: 'fixed', | ||
overflow: 'hidden', | ||
height: 'calc(var(--vh, 1vh) * 100)', | ||
width: '100vw', | ||
zIndex: zIndex.modal, | ||
backgroundColor: colors.navy_60, | ||
}} | ||
> | ||
<Row | ||
justifyContent={'center'} | ||
alignItems={'center'} | ||
gap={7.5} | ||
style={{ width: '100%', height: '100%' }} | ||
> | ||
<ALogoIcon width={65} fill={colors.A} /> | ||
<BLogoIcon width={66} fill={colors.B} /> | ||
</Row> | ||
</div> | ||
); | ||
}; | ||
|
||
export default Loading; |
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.