-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
load0ne
committed
May 29, 2021
1 parent
78ded14
commit 9ebe793
Showing
16 changed files
with
220 additions
and
7 deletions.
There are no files selected for viewing
Empty file.
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,5 @@ | ||
import styled from 'styled-components'; | ||
|
||
export const Calendar = styled.div` | ||
padding: 0 12px; | ||
`; |
54 changes: 54 additions & 0 deletions
54
components/Course/List/Sidebar/CourseList/CourseItem/CourseItem.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,54 @@ | ||
import React from 'react'; | ||
import { formatDate } from '~/util'; | ||
import * as $ from './CourseItemView'; | ||
|
||
type Props = { | ||
title: string; | ||
spotCount: number; | ||
timestamp: number; | ||
isPrivate: boolean; | ||
}; | ||
|
||
export default function CourseItem({ | ||
title, | ||
spotCount, | ||
timestamp, | ||
isPrivate, | ||
}: Props): JSX.Element { | ||
const dateStamp = formatDate(timestamp, true); | ||
|
||
const handleClickShare = () => { | ||
// TODO; | ||
}; | ||
const handleClickEdit = () => { | ||
// TODO; | ||
}; | ||
const handleClickDelete = () => { | ||
// TODO; | ||
}; | ||
|
||
return ( | ||
<$.CourseItem> | ||
<$.AreaInfo> | ||
<$.Stickers /> | ||
<$.Title>{title}</$.Title> | ||
<$.Info> | ||
<$.SpotCount>총 {spotCount}개 스팟</$.SpotCount> | ||
<$.Date>{dateStamp}</$.Date> | ||
</$.Info> | ||
</$.AreaInfo> | ||
{isPrivate && <$.AreaLabel>비공개</$.AreaLabel>} | ||
<$.AreaButton> | ||
<$.ItemButton onClick={handleClickShare}> | ||
<$.ShareIcon /> | ||
</$.ItemButton> | ||
<$.ItemButton onClick={handleClickEdit}> | ||
<$.EditIcon /> | ||
</$.ItemButton> | ||
<$.ItemButton onClick={handleClickDelete}> | ||
<$.DeleteIcon /> | ||
</$.ItemButton> | ||
</$.AreaButton> | ||
</$.CourseItem> | ||
); | ||
} |
102 changes: 102 additions & 0 deletions
102
components/Course/List/Sidebar/CourseList/CourseItem/CourseItemView.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,102 @@ | ||
import Image from 'next/image'; | ||
import styled from 'styled-components'; | ||
import painter from '~/styles/theme/painter'; | ||
|
||
export const CourseItem = styled.div` | ||
position: relative; | ||
padding: 24px 24px 23px; | ||
border-radius: 16px; | ||
border: 1px solid ${painter.grayscale[1]}; | ||
box-shadow: 0 0 4px 1px ${painter.grayscale[2]}; | ||
background-color: ${painter.basic.white}; | ||
& + & { | ||
margin-top: 24px; | ||
} | ||
`; | ||
|
||
export const AreaInfo = styled.div` | ||
padding-right: 108px; | ||
`; | ||
|
||
export const Stickers = styled.div` | ||
height: 40px; | ||
`; | ||
|
||
export const Title = styled.strong` | ||
margin-top: 13px; | ||
font-size: 24px; | ||
color: ${painter.basic.black}; | ||
`; | ||
|
||
export const Info = styled.div` | ||
margin-top: 4px; | ||
height: 20px; | ||
font-size: 0; | ||
line-height: 20px; | ||
color: ${painter.grayscale[8]}; | ||
`; | ||
|
||
export const SpotCount = styled.span` | ||
display: inline-block; | ||
vertical-align: top; | ||
font-weight: 700; | ||
font-size: 14px; | ||
`; | ||
|
||
export const Date = styled.span` | ||
display: inline-block; | ||
margin-left: 8px; | ||
vertical-align: top; | ||
font-size: 14px; | ||
`; | ||
|
||
export const AreaLabel = styled.div` | ||
position: absolute; | ||
right: 24px; | ||
bottom: 24px; | ||
font-size: 14px; | ||
line-height: 20px; | ||
color: ${painter.grayscale[6]}; | ||
`; | ||
|
||
export const AreaButton = styled.div` | ||
position: absolute; | ||
top: 24px; | ||
right: 24px; | ||
`; | ||
|
||
export const ItemButton = styled.button.attrs({ | ||
type: 'button', | ||
})` | ||
display: inline-block; | ||
height: 24px; | ||
vertical-align: top; | ||
cursor: pointer; | ||
& + & { | ||
margin-left: 8px; | ||
} | ||
`; | ||
|
||
export const ShareIcon = styled(Image).attrs({ | ||
width: '24', | ||
height: '24', | ||
src: '/course/list/share_gray.svg', | ||
})` | ||
display: block; | ||
`; | ||
|
||
export const EditIcon = styled(Image).attrs({ | ||
width: '24', | ||
height: '24', | ||
src: '/course/list/pen_gray.svg', | ||
})` | ||
display: block; | ||
`; | ||
|
||
export const DeleteIcon = styled(Image).attrs({ | ||
width: '24', | ||
height: '24', | ||
src: '/course/list/trashcan_gray.svg', | ||
})` | ||
display: block; | ||
`; |
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 './CourseItem'; |
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,5 +1,23 @@ | ||
import React from 'react'; | ||
import CourseItem from './CourseItem'; | ||
import * as $ from './CourseListView'; | ||
|
||
const unixNow = Math.floor(Date.now() / 1000); | ||
const dummy = [ | ||
{ title: 'abc', spotCount: 0, timestamp: unixNow, isPrivate: true }, | ||
{ title: 'abcd', spotCount: 5, timestamp: unixNow, isPrivate: false }, | ||
{ title: 'abce', spotCount: 2, timestamp: unixNow, isPrivate: true }, | ||
{ title: 'abcf', spotCount: 4, timestamp: unixNow, isPrivate: false }, | ||
{ title: 'abcg', spotCount: 3, timestamp: unixNow, isPrivate: true }, | ||
{ title: 'abch', spotCount: 11, timestamp: unixNow, isPrivate: false }, | ||
]; | ||
|
||
export default function CourseList(): JSX.Element { | ||
return null; | ||
return ( | ||
<$.CourseList> | ||
{dummy.map((dummyItem) => ( | ||
<CourseItem key={`course-list-${dummyItem.title}`} {...dummyItem} /> | ||
))} | ||
</$.CourseList> | ||
); | ||
} |
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,4 @@ | ||
import { makeVar, ReactiveVar } from '@apollo/client'; | ||
|
||
export const courses: ReactiveVar<GQL.Course[]> = makeVar([]); | ||
export const currentCourseIndex: ReactiveVar<number> = makeVar(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,5 @@ | ||
import styled from 'styled-components'; | ||
|
||
export const CourseList = styled.div` | ||
padding: 40px 24px; | ||
`; |
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.