-
Notifications
You must be signed in to change notification settings - Fork 27
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 #63 from boostcamp-2020/dev
[COMMON] 3주차 데모 버전
- Loading branch information
Showing
53 changed files
with
1,115 additions
and
150 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 |
---|---|---|
@@ -1,10 +1,11 @@ | ||
import { requestPOST } from '@/api'; | ||
import { requestGET, requestPOST } from '@/api'; | ||
|
||
const VIDEO_BASE_URL = '/video'; | ||
|
||
const videoAPI = { | ||
upload: (formData: FormData) => | ||
requestPOST(VIDEO_BASE_URL, formData, {}, true), | ||
getList: () => requestGET(`${VIDEO_BASE_URL}/list`), | ||
}; | ||
|
||
export default videoAPI; |
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
export { default } from './Button'; | ||
|
||
export type ButtonType = 'default' | 'transparent'; | ||
export type ButtonType = 'default' | 'transparent' | 'selected'; |
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,73 @@ | ||
import React from 'react'; | ||
import styled from 'styled-components'; | ||
|
||
import { Video } from '@/store/video/actions'; | ||
import color from '@/theme/colors'; | ||
import { parseDateString } from '@/utils/time'; | ||
|
||
const StyledDiv = styled.div` | ||
display: flex; | ||
align-items: center; | ||
justify-content: space-between; | ||
border-bottom: 1px solid ${color.BORDER}; | ||
font-size: 13px; | ||
${({ isChecked }) => | ||
`background-color: ${ | ||
isChecked ? `${color.DARK_PURPLE}` : `${color.MODAL}` | ||
};`} | ||
&:hover { | ||
background-color: ${color.BORDER}; | ||
} | ||
`; | ||
|
||
const WrapperDiv = styled.div` | ||
display: flex; | ||
width: 100%; | ||
align-items: center; | ||
justify-content: space-between; | ||
margin: 0 1rem; | ||
`; | ||
|
||
const Image = styled.img` | ||
width: 2.5rem; | ||
height: 2rem; | ||
`; | ||
const NameDiv = styled.div` | ||
width: 70%; | ||
margin-left: 1rem; | ||
`; | ||
|
||
const Name = styled.p` | ||
white-space: nowrap; | ||
`; | ||
|
||
const Timestamp = styled.p` | ||
font-size: 12px; | ||
white-space: nowrap; | ||
`; | ||
|
||
interface Props { | ||
video: Video; | ||
selected: Video; | ||
handleCheck: Function; | ||
} | ||
|
||
const VideoItem: React.FC<Props> = ({ video, handleCheck, selected }) => { | ||
return ( | ||
<StyledDiv | ||
onClick={() => handleCheck(video)} | ||
isChecked={selected === video} | ||
> | ||
<WrapperDiv> | ||
<Image src="https://user-images.githubusercontent.com/49153756/99666210-03b80600-2aae-11eb-95b9-f61f52694708.png" /> | ||
<NameDiv> | ||
<Name>{video.name}</Name> | ||
</NameDiv> | ||
<Timestamp>{parseDateString(new Date(), video.updatedAt)}</Timestamp> | ||
</WrapperDiv> | ||
</StyledDiv> | ||
); | ||
}; | ||
|
||
export default VideoItem; |
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,59 @@ | ||
import React, { useEffect, useState } from 'react'; | ||
import styled from 'styled-components'; | ||
import { useSelector, useDispatch } from 'react-redux'; | ||
|
||
import { fetchListStart } from '@/store/video/actions'; | ||
import { getVideos } from '@/store/selectors'; | ||
import color from '@/theme/colors'; | ||
import VideoItem from './VideoItem'; | ||
|
||
const StyledDiv = styled.div` | ||
display: flex; | ||
flex-direction: column; | ||
justify-content: center; | ||
background-color: ${color.MODAL}; | ||
border-radius: 12px 12px 0 0; | ||
`; | ||
|
||
const Header = styled.div` | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
border-bottom: 1px solid ${color.BORDER}; | ||
padding: 10px; | ||
`; | ||
|
||
const List = styled.div` | ||
height: 50vh; | ||
overflow-y: auto; | ||
`; | ||
|
||
const VideoList: React.FC = () => { | ||
const [selected, setSelected] = useState(null); | ||
const videos = useSelector(getVideos); | ||
const dispatch = useDispatch(); | ||
|
||
const handleCheck = video => setSelected(video); | ||
|
||
useEffect(() => { | ||
if (!videos) dispatch(fetchListStart()); | ||
}, [videos]); | ||
|
||
return ( | ||
<StyledDiv> | ||
<Header>Video List</Header> | ||
<List> | ||
{videos?.map(video => ( | ||
<VideoItem | ||
key={video.name} | ||
video={video} | ||
handleCheck={handleCheck} | ||
selected={selected} | ||
/> | ||
))} | ||
</List> | ||
</StyledDiv> | ||
); | ||
}; | ||
|
||
export default VideoList; |
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 @@ | ||
export { default } from './VideoList'; |
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
Oops, something went wrong.