This repository has been archived by the owner on Apr 14, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
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
1 parent
4f8a9f5
commit 607d54f
Showing
10 changed files
with
415 additions
and
48 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
Large diffs are not rendered by default.
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,84 @@ | ||
|
||
import React, { Component, Fragment } from "react"; | ||
|
||
export default class IBoard extends Component { | ||
|
||
constructor() { | ||
super(); | ||
|
||
this.state = { | ||
currentPage: 1, | ||
currentPerPage: 15, | ||
totalLength: 0, | ||
items: [], | ||
}; | ||
} | ||
|
||
async componentDidMount() { | ||
await this.fetchBoardData(); | ||
} | ||
|
||
/** | ||
* Calculator page limit using state information. | ||
*/ | ||
getPageLimit() { | ||
return Math.ceil(this.state.totalLength / this.state.currentPerPage); | ||
} | ||
|
||
/** | ||
* Must override in subclass. | ||
* return table head | ||
*/ | ||
renderHead() { | ||
return ( | ||
<tr> | ||
<th>Board Template</th> | ||
</tr> | ||
) | ||
} | ||
|
||
/** | ||
* Must override in subclass. | ||
* @param {object} item | ||
*/ | ||
renderItem(item) { | ||
return ( | ||
<tr> | ||
<td>{item}</td> | ||
</tr> | ||
) | ||
} | ||
|
||
/** | ||
* Must override in subclass. | ||
*/ | ||
async fetchBoardData() { | ||
console.log('fetch'); | ||
} | ||
|
||
onClickRefresh() { | ||
console.log('hello'); | ||
} | ||
|
||
render() { | ||
return ( | ||
<Fragment> | ||
<h2>{this.state.boardName}</h2> | ||
<div> | ||
<button onClick={()=> this.onClickRefresh()}>Refresh</button> | ||
</div> | ||
<table> | ||
<thead> | ||
{ this.renderHead() } | ||
</thead> | ||
<tbody> | ||
{ this.state.items.map(item=>this.renderItem(item)) } | ||
</tbody> | ||
</table> | ||
<div> | ||
|
||
</div> | ||
</Fragment> | ||
) | ||
} | ||
} |
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,45 @@ | ||
|
||
import IBoard from "./IBoard"; | ||
|
||
export default class NoticeBoard extends IBoard { | ||
|
||
renderHead() { | ||
return ( | ||
<tr> | ||
<th>Notice Id</th> | ||
<th>Notice Header</th> | ||
<th>Notice Title</th> | ||
<th>Notice Writer</th> | ||
<th>Notice View</th> | ||
</tr>) | ||
} | ||
|
||
renderItem(item) { | ||
return <tr key={item.identifier}> | ||
<td>{item.identifier}</td> | ||
<td>{item.header}</td> | ||
<td>{item.title}</td> | ||
<td>{item.writer}</td> | ||
<td>{item.numOfView}</td> | ||
</tr> | ||
} | ||
|
||
async fetchBoardData() { | ||
const res = await fetch(`/api/v1/notice/get/list?page=${this.state.currentPage}&per=${this.state.currentPerPage}`); | ||
|
||
if(res.status != 200) throw Error('error!'); | ||
|
||
const data = await res.json(); | ||
|
||
this.setState({ | ||
currentPage : data.currentPage, | ||
currentPerPage : data.countPerPage, | ||
totalLength: data.totalCount, | ||
items: data.values | ||
}); | ||
} | ||
|
||
onClickRefresh() { | ||
|
||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
const React = require('react'); | ||
const ReactDom = require('react-dom'); | ||
const { default: WordRelay } = require('./WordRelay'); | ||
import React from 'react'; | ||
import ReactDOM from 'react-dom'; | ||
import NoticeBoard from './NoticeBoard'; | ||
|
||
ReactDom.render(<WordRelay/>, document.querySelector('#root')); | ||
ReactDOM.render(<NoticeBoard/>, document.querySelector('#noticeTable')); |
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