diff --git a/src/pages/challenge-list/components/contents/index.tsx b/src/pages/challenge-list/components/contents/index.tsx new file mode 100644 index 0000000..2aa0b64 --- /dev/null +++ b/src/pages/challenge-list/components/contents/index.tsx @@ -0,0 +1,83 @@ +import { useState } from 'react'; + +import { Box, Text } from '@chakra-ui/react'; +import styled from '@emotion/styled'; + +type Props = { + title: string; + content: string; + startDate: string; + endDate: string; + participantCount: number; +}; + +const Contents = ({ + title, + content, + startDate, + endDate, + participantCount, +}: Props) => { + const [isClicked, setIsClicked] = useState(false); + + const handleBoxClick = () => { + setIsClicked(!isClicked); + }; + + const date = `${startDate} ~ ${endDate}`; + + return ( + + + + {title} + + + + {content} + + 누적 참여자 수 : {participantCount}명 + + + + + 참여 가능 기간 + + {date} + + + ); +}; + +export default Contents; + +const ContentsBox = styled(Box)<{ isClicked: boolean }>` + width: 100%; + height: 100%; + background-color: ${({ isClicked }) => + isClicked ? 'var(--color-green-06)' : 'var(--color-green-01)'}; + border-radius: 1.2rem; + padding: 1rem; + box-shadow: 0px 4px 4px rgba(0, 0, 0, 0.25); + text-align: left; + display: flex; + flex-direction: column; + align-items: flex-start; + margin-bottom: 1.5rem; + cursor: pointer; +`; + +const FlexBox = styled(Box)` + display: flex; + flex-direction: column; + gap: 1rem; +`; + +const TextItem = styled(Text)<{ isClicked: boolean }>` + color: ${({ isClicked }) => (isClicked ? '#000' : '#fff')}; + font-size: 1rem; +`;