Skip to content

Commit

Permalink
answer list UI 추가(mash-up-kr#2)
Browse files Browse the repository at this point in the history
*wip: answer component 추가
*wip: answer list component 추가
  • Loading branch information
godjoy committed Feb 27, 2021
1 parent bd0604f commit f941377
Show file tree
Hide file tree
Showing 2 changed files with 97 additions and 0 deletions.
65 changes: 65 additions & 0 deletions src/components/answerlist/AnswerComp.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
import React from 'react'
import styled from 'styled-components'
import { Answer } from 'types/Answer'

function AnswerComp({ name, contents, time, likeNum }: Answer) {
return (
<>
<AnswerBlock>
<div className="userName">{name}</div>
<div className="contents">{contents}</div>
<AnswerInfoBlock>
<div className="time">{time}</div>
<div className="likeButton">{likeNum}</div>
</AnswerInfoBlock>
</AnswerBlock>
</>
)
}

export default AnswerComp

const AnswerBlock = styled.div`
display: inline-block;
width: 328px;
height: fit-content;
margin: 15px 15px 0px;
text-align: left;
border-bottom: 1px solid #5e5474;
.userName {
font-weight: 400;
}
.contents {
display: inline-block;
width: 328px;
height: fit-content;
margin: 10px 0px;
line-height: 130%;
font-size: 11pt;
}
`
const AnswerInfoBlock = styled.div`
display: flex;
margin-bottom: 10px;
.time {
display: inline-block;
color: #716d74;
align-items: center;
justify-content: center;
padding-right: 80px;
padding-top: 10px;
}
.likeButton {
display: felx;
width: 80px;
height: 24px;
align-items: center;
justify-content: center;
background-color: #5e5474;
border-radius: 5px;
text-align: center;
}
`
32 changes: 32 additions & 0 deletions src/components/answerlist/AnswerList.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import React, { useState } from 'react'
import AnswerComp from './AnswerComp'
import styled from 'styled-components'
import { AnswerListProps } from 'types/Answer'

function AnswerList({ answers }: AnswerListProps) {
return (
<>
<AnswerListLayout>
{answers.map(answer => (
<AnswerComp
name={answer.name}
contents={answer.contents}
time={answer.time}
likeNum={answer.likeNum}
/>
))}
</AnswerListLayout>
</>
)
}

export default AnswerList

const AnswerListLayout = styled.div`
position: relative;
width: 360px;
height: 455px;
background-color: #514184;
border-radius: 16px 16px 0px 0px;
color: white;
`

0 comments on commit f941377

Please sign in to comment.