-
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.
* Feat/member api (#28) * feat: group_id propType 추가 * feat: excel key 사용 --------- Co-authored-by: 조준호 <[email protected]> * feat: eventListPage 생성 (#31) Co-authored-by: 조준호 <[email protected]> * [chore] 모임 생성 버튼 추가 * feat: upload Members (#33) Co-authored-by: 조준호 <[email protected]> * refact: addMember API 수정 (#34) Co-authored-by: 조준호 <[email protected]> --------- Co-authored-by: dassasa <[email protected]> Co-authored-by: 조준호 <[email protected]>
- Loading branch information
1 parent
7320593
commit 76cc14a
Showing
15 changed files
with
291 additions
and
53 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
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,39 @@ | ||
import React, { useState, useEffect } from 'react' | ||
import { Collapse } from 'antd' | ||
import { getEvent } from '../../apis/event' | ||
import styled from 'styled-components' | ||
|
||
const { Panel } = Collapse | ||
|
||
const EventCard = ({ groupId }) => { | ||
const [events, setEvents] = useState([]) | ||
useEffect(() => { | ||
getEvent(groupId).then((data) => { | ||
setEvents(data) | ||
}) | ||
}, [groupId]) | ||
|
||
return ( | ||
<StyledCollapse accordion bordered={false}> | ||
{events.map((event) => ( | ||
<Panel header={event.name} key={event._id}> | ||
<p> | ||
<strong>설명: </strong> {event.description} | ||
</p> | ||
<p> | ||
<strong>회비: </strong> {event.fee} | ||
</p> | ||
</Panel> | ||
))} | ||
</StyledCollapse> | ||
) | ||
} | ||
|
||
const StyledCollapse = styled(Collapse)` | ||
width: 60%; | ||
margin-top: 100px; | ||
padding: 10px; | ||
background-color: rgba(0, 62.67, 151.94, 0.08); | ||
` | ||
|
||
export default EventCard |
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,99 @@ | ||
import React, { useState } from 'react' | ||
import { uploadMember } from '../../apis/members' | ||
import { InboxOutlined } from '@ant-design/icons' | ||
import { Upload, Button } from 'antd' | ||
import styled from 'styled-components' | ||
|
||
const { Dragger } = Upload | ||
|
||
const UploadMember = ({ groupId }) => { | ||
const [file, setFile] = useState(null) | ||
const [isFileUploaded, setIsFileUploaded] = useState(false) | ||
|
||
const props = { | ||
name: 'file', | ||
accept: '.xlsx, .xls, .csv', | ||
multiple: false, | ||
showUploadList: false, | ||
beforeUpload: (file) => { | ||
setFile(file) | ||
setIsFileUploaded(true) | ||
return false | ||
}, | ||
} | ||
|
||
const handleUpload = async () => { | ||
await uploadMember(groupId, file).then((res) => { | ||
console.log(res) | ||
}) | ||
alert('파일이 업로드되었습니다.') | ||
window.location.reload() | ||
} | ||
|
||
return ( | ||
<Wrapper> | ||
<StyledButton onClick={handleUpload} type="primary" disabled={!isFileUploaded}> | ||
확인 | ||
</StyledButton> | ||
|
||
<StyledDragger {...props}> | ||
{file ? ( | ||
<FileIconWrapper> | ||
<img | ||
src="https://img.icons8.com/ios/452/file.png" | ||
style={{ width: '64px', height: '64px' }} | ||
alt="file" | ||
/> | ||
<p>{file.name}</p> | ||
</FileIconWrapper> | ||
) : ( | ||
<div> | ||
<p className="ant-upload-drag-icon"> | ||
<InboxOutlined style={{ fontSize: '64px', color: '#1890ff' }} /> | ||
</p> | ||
<p className="ant-upload-text">클릭 또는 파일을 드래그하여 업로드하세요</p> | ||
<p className="ant-upload-hint">xlsx, csv 파일만 첨부 가능</p> | ||
</div> | ||
)} | ||
</StyledDragger> | ||
</Wrapper> | ||
) | ||
} | ||
|
||
export const StyledButton = styled(Button)` | ||
margin-top: 20px; | ||
margin-bottom: 10px; | ||
width: 100px; | ||
height: 50px; | ||
font-size: 20px; | ||
font-weight: 500; | ||
//글씨 수직 맞추기 | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
background-color: #003e97; | ||
` | ||
export const StyledDragger = styled(Dragger)` | ||
width: 100%; | ||
height: 100%; | ||
padding: 10px; | ||
background-color: rgba(0, 62.67, 151.94, 0.08); | ||
border-radius: 10px; | ||
` | ||
|
||
export const Wrapper = styled.div` | ||
display: flex; | ||
flex-direction: column; | ||
align-items: end; | ||
width: 50%; | ||
` | ||
const FileIconWrapper = styled.div` | ||
width: 100%; | ||
height: 100%; | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
` | ||
|
||
export default UploadMember |
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,10 @@ | ||
import React from 'react' | ||
import EventCard from '../../Components/Card/EventCard' | ||
|
||
const ShowEventList = () => { | ||
const groupId = window.location.href.split('/')[4] | ||
|
||
return <EventCard groupId={groupId} /> | ||
} | ||
|
||
export default ShowEventList |
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
Oops, something went wrong.