-
Notifications
You must be signed in to change notification settings - Fork 1
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 #22 from wanted-pre-onboarding-frontend-12team/fea…
…ture/issue [#15] 이슈 컴포넌트 구현
- Loading branch information
Showing
19 changed files
with
238 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import React from 'react'; | ||
|
||
import CommonTitle from '../../../shared/Title'; | ||
import { IssueWriter, IssueComment, IssueTime, IssueNumber } from '../../'; | ||
import { IssueLayout, BorderLine } from './styled'; | ||
|
||
export default function Issue({ issueItem, userItem }: any) { | ||
const style = {}; | ||
const { comments, number, title, created_at, updated_at } = issueItem; | ||
const { login, html_url, avatar_url } = userItem; | ||
|
||
return ( | ||
<IssueLayout> | ||
<div className="title"> | ||
<CommonTitle style={style}> | ||
{title} | ||
<IssueNumber issueNumber={number} /> | ||
</CommonTitle> | ||
</div> | ||
<IssueWriter writerName={login} /> | ||
<div className="IssueInfo"> | ||
<IssueTime writeTime={created_at} /> | ||
<IssueComment commentCount={comments} /> | ||
</div> | ||
<BorderLine /> | ||
</IssueLayout> | ||
); | ||
} |
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,34 @@ | ||
import styled from 'styled-components'; | ||
|
||
export const IssueLayout = styled.section` | ||
display: flex; | ||
flex-direction: column; | ||
cursor: pointer; | ||
.title { | ||
display: flex; | ||
align-items: end; | ||
} | ||
gap: 7px; | ||
@media ${({ theme }) => theme.device.laptop} { | ||
gap: 12px; | ||
} | ||
font-size: ${({ theme }) => theme.fontSizes.normal}; | ||
@media ${({ theme }) => theme.device.laptop} { | ||
font-size: ${({ theme }) => theme.fontSizes.large}; | ||
} | ||
.IssueInfo { | ||
display: flex; | ||
flex-direction: row; | ||
justify-content: space-between; | ||
align-items: center; | ||
} | ||
`; | ||
|
||
export const BorderLine = styled.div` | ||
height: 1px; | ||
background: #000000; | ||
margin: 10px 0; | ||
@media ${({ theme }) => theme.device.laptop} { | ||
margin: 20px 0; | ||
} | ||
`; |
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,15 @@ | ||
import CommentIcon from './speech-bubble.svg'; | ||
import { CommentLayout } from './styled'; | ||
|
||
type Prop = { | ||
commentCount: number; | ||
}; | ||
|
||
export default function IssueComment({ commentCount }: Prop) { | ||
return ( | ||
<CommentLayout> | ||
<img className={'speechIcon'} src={CommentIcon} /> | ||
<p>{commentCount}</p> | ||
</CommentLayout> | ||
); | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,18 @@ | ||
import styled from 'styled-components'; | ||
|
||
export const CommentLayout = styled.section` | ||
display: flex; | ||
gap: 7px; | ||
font-size: ${({ theme }) => theme.fontSizes.normal}; | ||
@media ${({ theme }) => theme.device.laptop} { | ||
font-size: ${({ theme }) => theme.fontSizes.large}; | ||
} | ||
.speechIcon { | ||
width: 20px; | ||
height: 20px; | ||
@media ${({ theme }) => theme.device.laptop} { | ||
width: 30px; | ||
height: 30px; | ||
} | ||
} | ||
`; |
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,9 @@ | ||
import { NumberLayout } from './styled'; | ||
|
||
type Props = { | ||
issueNumber: number; | ||
}; | ||
|
||
export default function IssueNumber({ issueNumber }: Props) { | ||
return <NumberLayout>#{issueNumber}</NumberLayout>; | ||
} |
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,11 @@ | ||
import styled from 'styled-components'; | ||
|
||
export const NumberLayout = styled.span` | ||
font-size: ${({ theme }) => theme.fontSizes.normal}; | ||
padding-left: 7px; | ||
color: ${({ theme }) => theme.colors.gray}; | ||
@media ${({ theme }) => theme.device.laptop} { | ||
font-size: ${({ theme }) => theme.fontSizes.large}; | ||
padding-left: 10px; | ||
} | ||
`; |
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,10 @@ | ||
import DateFormat from '../../../utils/dateFormat'; | ||
import { TimeLayout } from './styled'; | ||
|
||
type Prop = { | ||
writeTime: string; | ||
}; | ||
|
||
export default function IssueTime({ writeTime }: Prop) { | ||
return <TimeLayout>{DateFormat({ writeTime })}에 열림</TimeLayout>; | ||
} |
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,9 @@ | ||
import styled from 'styled-components'; | ||
|
||
export const TimeLayout = styled.p` | ||
color: ${({ theme }) => theme.colors.gray}; | ||
font-size: ${({ theme }) => theme.fontSizes.normal}; | ||
@media ${({ theme }) => theme.device.laptop} { | ||
font-size: ${({ theme }) => theme.fontSizes.large}; | ||
} | ||
`; |
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,9 @@ | ||
import { WriterLayout } from './styled'; | ||
|
||
type Prop = { | ||
writerName: string; | ||
}; | ||
|
||
export default function IssueWriter({ writerName }: Prop) { | ||
return <WriterLayout>{writerName}</WriterLayout>; | ||
} |
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,8 @@ | ||
import styled from 'styled-components'; | ||
|
||
export const WriterLayout = styled.p` | ||
font-size: ${({ theme }) => theme.fontSizes.normal}; | ||
@media ${({ theme }) => theme.device.laptop} { | ||
font-size: ${({ theme }) => theme.fontSizes.large}; | ||
} | ||
`; |
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,16 @@ | ||
import { useContext } from 'react'; | ||
import Issue from '../../components/feature/Issue'; | ||
import { IssueContext } from '../../constants/IssueProvider'; | ||
|
||
export default function IssueList() { | ||
const { issueList, newUserList }: any = useContext(IssueContext); | ||
|
||
return ( | ||
<> | ||
{issueList && | ||
issueList.map((issueItem: any, index: number) => { | ||
return <Issue key={index} issueItem={issueItem} userItem={newUserList[index]} />; | ||
})} | ||
</> | ||
); | ||
} |
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
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,8 @@ | ||
type Prop = { | ||
writeTime: string; | ||
}; | ||
|
||
export default function DateFormat({ writeTime }: Prop) { | ||
const [year, month, day] = new Date(writeTime).toLocaleDateString().split('.').slice(0, 3); | ||
return `${year}년 ${month}월 ${day}일`; | ||
} |