-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #173 from woowacourse-teams/feature/CK-210
[feat/CK-210] ๋ก๋๋งต ๋ํ ์ผ ํ์ด์ง์ UI๋ฅผ ๊ฐํธํ๋ค.
- Loading branch information
Showing
9 changed files
with
388 additions
and
52 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
48 changes: 48 additions & 0 deletions
48
client/src/components/roadmapDetailPage/extraInfo/ExtraInfo.styles.ts
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,48 @@ | ||
import styled from 'styled-components'; | ||
import media from '@styles/media'; | ||
|
||
export const ExtraInfo = styled.div` | ||
${({ theme }) => theme.fonts.description5}; | ||
display: flex; | ||
flex-direction: column; | ||
align-items: flex-end; | ||
justify-content: space-between; | ||
width: 30%; | ||
height: 55rem; | ||
${media.mobile` | ||
display: none; | ||
`} | ||
`; | ||
|
||
export const RoadmapMetadata = styled.div` | ||
display: flex; | ||
flex-direction: column; | ||
& > div:not(:last-child) { | ||
margin-bottom: 3rem; | ||
} | ||
`; | ||
|
||
export const Category = styled.div` | ||
display: flex; | ||
align-items: center; | ||
justify-content: flex-end; | ||
`; | ||
|
||
export const Difficulty = styled.div` | ||
text-align: end; | ||
`; | ||
|
||
export const RecommendedRoadmapPeriod = styled.div` | ||
text-align: end; | ||
`; | ||
|
||
export const Tags = styled.div` | ||
color: ${({ theme }) => theme.colors.main_dark}; | ||
& > div { | ||
text-align: end; | ||
} | ||
`; |
33 changes: 33 additions & 0 deletions
33
client/src/components/roadmapDetailPage/extraInfo/ExtraInfo.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,33 @@ | ||
import { RoadmapDetailType } from '@myTypes/roadmap/internal'; | ||
import * as S from './ExtraInfo.styles'; | ||
import SVGIcon from '@components/icons/SVGIcon'; | ||
import { CategoriesInfo } from '@constants/roadmap/category'; | ||
|
||
type ExtraInfoProps = { | ||
roadmapInfo: RoadmapDetailType; | ||
}; | ||
|
||
const ExtraInfo = ({ roadmapInfo }: ExtraInfoProps) => { | ||
return ( | ||
<S.ExtraInfo> | ||
<div>Created by {roadmapInfo.creator.name}</div> | ||
<S.RoadmapMetadata> | ||
<S.Category> | ||
์นดํ ๊ณ ๋ฆฌ: {roadmapInfo.category.name} | ||
<SVGIcon name={CategoriesInfo[roadmapInfo.category.id].iconName} /> | ||
</S.Category> | ||
<S.Difficulty>๋์ด๋: {roadmapInfo.difficulty}</S.Difficulty> | ||
<S.RecommendedRoadmapPeriod> | ||
์์ ์์์๊ฐ: {roadmapInfo.recommendedRoadmapPeriod}์ผ | ||
</S.RecommendedRoadmapPeriod> | ||
</S.RoadmapMetadata> | ||
<S.Tags> | ||
{roadmapInfo.tags.map((tag) => ( | ||
<div key={tag.id}>#{tag.name}</div> | ||
))} | ||
</S.Tags> | ||
</S.ExtraInfo> | ||
); | ||
}; | ||
|
||
export default ExtraInfo; |
47 changes: 47 additions & 0 deletions
47
client/src/components/roadmapDetailPage/introduction/Introduction.styles.ts
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,47 @@ | ||
import media from '@styles/media'; | ||
import styled from 'styled-components'; | ||
|
||
export const IntroductionWrapper = styled.div` | ||
width: 70%; | ||
${media.mobile` | ||
width:100%; | ||
`} | ||
`; | ||
|
||
export const Introduction = styled.div<{ isExpanded: boolean }>` | ||
${({ theme }) => theme.fonts.description5}; | ||
overflow: hidden; | ||
max-height: ${({ isExpanded }) => (isExpanded ? 'auto' : '55rem')}; | ||
& > p:not(:last-child) { | ||
margin-bottom: 2rem; | ||
} | ||
& div { | ||
${({ theme }) => theme.fonts.h1}; | ||
margin-bottom: 0.5rem; | ||
color: ${({ theme }) => theme.colors.main_dark}; | ||
} | ||
`; | ||
|
||
export const LineShadow = styled.div` | ||
position: relative; | ||
width: 100%; | ||
height: 0.2rem; | ||
box-shadow: 0 -4px 6px rgba(0, 0, 0, 1); | ||
`; | ||
|
||
export const ReadMoreButton = styled.button` | ||
position: relative; | ||
top: calc(-2rem - 4px); | ||
left: 50%; | ||
transform: translateX(-5rem); | ||
width: 10rem; | ||
height: 4rem; | ||
background-color: ${({ theme }) => theme.colors.white}; | ||
border-radius: 8px; | ||
box-shadow: ${({ theme }) => theme.shadows.main}; | ||
`; |
51 changes: 51 additions & 0 deletions
51
client/src/components/roadmapDetailPage/introduction/Introduction.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,51 @@ | ||
import { RoadmapDetailType } from '@myTypes/roadmap/internal'; | ||
import * as S from './Introduction.styles'; | ||
import { useEffect, useRef, useState } from 'react'; | ||
|
||
type IntroductionProps = { | ||
roadmapInfo: RoadmapDetailType; | ||
}; | ||
|
||
const Introduction = ({ roadmapInfo }: IntroductionProps) => { | ||
const [isExpanded, setIsExpanded] = useState(false); | ||
const [showMoreButton, setShowMoreButton] = useState(false); | ||
const introRef = useRef<HTMLDivElement>(null); | ||
|
||
useEffect(() => { | ||
if (!introRef.current) return; | ||
|
||
const element = introRef.current; | ||
if (element.scrollHeight > element.clientHeight) { | ||
setShowMoreButton(true); | ||
} | ||
}, []); | ||
|
||
const toggleExpand = () => { | ||
setIsExpanded((prev) => !prev); | ||
}; | ||
|
||
return ( | ||
<S.IntroductionWrapper> | ||
<S.Introduction isExpanded={isExpanded} ref={introRef}> | ||
<p> | ||
<div>์ค๋ช </div> | ||
{roadmapInfo.introduction} | ||
</p> | ||
<p> | ||
<div>๋ณธ๋ฌธ</div> | ||
{roadmapInfo.content.content === '' | ||
? '๋ก๋๋งต์ ๋ํ ์ค๋ช ์ด ์์ด์๐ฅฒ' | ||
: roadmapInfo.content.content} | ||
</p> | ||
</S.Introduction> | ||
{showMoreButton && !isExpanded && ( | ||
<> | ||
<S.LineShadow /> | ||
<S.ReadMoreButton onClick={toggleExpand}>๋ ๋ณด๊ธฐ</S.ReadMoreButton> | ||
</> | ||
)} | ||
</S.IntroductionWrapper> | ||
); | ||
}; | ||
|
||
export default Introduction; |
90 changes: 90 additions & 0 deletions
90
client/src/components/roadmapDetailPage/nodeContent/NodeContent.styles.ts
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,90 @@ | ||
import styled from 'styled-components'; | ||
import media from '@styles/media'; | ||
|
||
export const SliderContent = styled.div` | ||
display: flex; | ||
aspect-ratio: 5 / 3.5; | ||
background-color: ${({ theme }) => theme.colors.gray100}; | ||
border-radius: 8px; | ||
${media.mobile` | ||
aspect-ratio: 0; | ||
`} | ||
`; | ||
|
||
export const LeftContent = styled.div` | ||
width: 45%; | ||
${media.mobile` | ||
display: none; | ||
`} | ||
`; | ||
|
||
export const NodeImg = styled.img` | ||
width: 100%; | ||
height: 100%; | ||
padding: 1.5rem; | ||
object-fit: cover; | ||
`; | ||
|
||
export const NoImg = styled.div` | ||
${({ theme }) => theme.fonts.title_large} | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
justify-content: center; | ||
width: 100%; | ||
height: 100%; | ||
`; | ||
|
||
export const Separator = styled.div` | ||
display: flex; | ||
flex-direction: column; | ||
width: 0.2rem; | ||
height: 100%; | ||
& > div { | ||
height: 50%; | ||
} | ||
& > div:last-child { | ||
background-color: black; | ||
} | ||
`; | ||
|
||
export const RightContent = styled.div` | ||
${({ theme }) => theme.fonts.h1} | ||
overflow: scroll; | ||
width: 55%; | ||
padding: 1.5rem; | ||
padding-top: 3rem; | ||
${media.mobile` | ||
width: 100%; | ||
height: 60rem; | ||
padding-top: 1.5rem; | ||
`} | ||
`; | ||
|
||
export const ContentTitle = styled.div` | ||
${({ theme }) => theme.fonts.title_large} | ||
display: flex; | ||
align-items: center; | ||
margin-bottom: 1rem; | ||
`; | ||
|
||
export const Step = styled.div` | ||
${({ theme }) => theme.fonts.h2} | ||
display: flex; | ||
flex-shrink: 0; | ||
align-items: center; | ||
justify-content: center; | ||
width: 3rem; | ||
height: 3rem; | ||
margin-right: 0.5rem; | ||
border: 0.3rem solid black; | ||
border-radius: 50%; | ||
`; |
38 changes: 38 additions & 0 deletions
38
client/src/components/roadmapDetailPage/nodeContent/NodeContent.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,38 @@ | ||
import type { NodeType } from '@myTypes/roadmap/internal'; | ||
import * as S from './NodeContent.styles'; | ||
import SVGIcon from '@components/icons/SVGIcon'; | ||
|
||
type NodeContentProps = { | ||
node: NodeType; | ||
index: number; | ||
}; | ||
|
||
const NodeContent = ({ node, index }: NodeContentProps) => { | ||
return ( | ||
<S.SliderContent key={node.id}> | ||
<S.LeftContent> | ||
{node.imageUrls[0] ? ( | ||
<S.NodeImg src={node.imageUrls[0]} /> | ||
) : ( | ||
<S.NoImg> | ||
<SVGIcon name='NoImageIcon' size={100} /> | ||
<div>No Image</div> | ||
</S.NoImg> | ||
)} | ||
</S.LeftContent> | ||
<S.Separator> | ||
<div /> | ||
<div /> | ||
</S.Separator> | ||
<S.RightContent> | ||
<S.ContentTitle> | ||
<S.Step>{index + 1}</S.Step> | ||
<p>{node.title}</p> | ||
</S.ContentTitle> | ||
{node.description} | ||
</S.RightContent> | ||
</S.SliderContent> | ||
); | ||
}; | ||
|
||
export default NodeContent; |
Oops, something went wrong.