-
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.
changed folder get controller to include chip code, added chip table …
…for single folder page
- Loading branch information
1 parent
bba7ce8
commit 7b7d612
Showing
12 changed files
with
220 additions
and
9 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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"name": "webpack-demo", | ||
"name": "xtra-redux client", | ||
"version": "1.0.0", | ||
"description": "", | ||
"private": true, | ||
|
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,37 @@ | ||
import React, { Fragment } from 'react'; | ||
|
||
|
||
const ChipList = ({chips = null}) => { | ||
return( | ||
<Fragment> | ||
{ | ||
chips.map((chip) => { | ||
return ( | ||
<div key={chip.id} className="card"> | ||
<header className="card-header"> | ||
<div className="card-header-title"> | ||
<p className="">No. {chip.chip_number} - {chip.original_name}</p> | ||
</div> | ||
</header> | ||
<div className="card-content"> | ||
<div className="content chip-body-info"> | ||
<p>Element: {chip.element}</p> | ||
<p>Memory: {chip.memory}</p> | ||
<p>Rarity: {chip.rarity}</p> | ||
<p>Type: {chip.type}</p> | ||
</div> | ||
</div> | ||
<footer className="card-footer"> | ||
<div href="#" className="card-footer-item">{chip.damage}</div> | ||
<a href="#" className="card-footer-item">Edit</a> | ||
<a href="#" className="card-footer-item">Delete</a> | ||
</footer> | ||
</div> | ||
); | ||
}) | ||
} | ||
</Fragment> | ||
) | ||
} | ||
|
||
export default ChipList; |
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, { Fragment } from 'react'; | ||
import PT from 'prop-types'; | ||
|
||
const ChipTable = ({chips}) => { | ||
return( | ||
<div className="table-container"> | ||
<table className='table is-fullwidth is-striped'> | ||
<thead> | ||
<tr> | ||
<th>No.</th> | ||
<th>Name</th> | ||
<th>Element</th> | ||
<th>Damage</th> | ||
<th>Code</th> | ||
<th>Memory</th> | ||
<th>Rarity</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
{ | ||
chips.map((chip) => { | ||
return (<tr> | ||
<td>{chip.chip_number}</td> | ||
<td>{chip.original_name}</td> | ||
<td>{chip.element}</td> | ||
<td>{chip.damage}</td> | ||
<td>{chip.code}</td> | ||
<td>{chip.memory}</td> | ||
<td>{chip.rarity}</td> | ||
</tr>) | ||
}) | ||
} | ||
</tbody> | ||
</table> | ||
</div> | ||
) | ||
} | ||
|
||
export default ChipTable; |
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 React, { Fragment } from 'react'; | ||
import ChipList from './ChipList.jsx'; | ||
import ChipTable from './ChipTable.jsx' | ||
|
||
class SingleFolder extends React.Component { | ||
constructor(props) { | ||
super(props); | ||
} | ||
|
||
render() { | ||
const { title, author, created_at, child_chips = [] } = this.props; | ||
return ( | ||
<Fragment> | ||
<section className="hero is-primary"> | ||
<div className="hero-body"> | ||
<div className="container"> | ||
<h1 className="title"> | ||
{title} | ||
</h1> | ||
<h2 className="subtitle"> | ||
By - {author && author.username} | ||
</h2> | ||
</div> | ||
</div> | ||
</section> | ||
<div className="container single-folder-container"> | ||
<ChipTable chips = {child_chips}/> | ||
</div> | ||
</Fragment> | ||
); | ||
} | ||
} | ||
|
||
export default SingleFolder; |
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,27 @@ | ||
import React from 'react'; | ||
import axios from 'axios'; | ||
import SingleFolder from './../containers/SingleFolder/index.jsx'; | ||
|
||
class Folder extends React.Component { | ||
constructor(props) { | ||
super(props); | ||
} | ||
|
||
componentDidMount() { | ||
const BASE_URL = 'http://localhost:3000/api/' | ||
const { match: { params } } = this.props; | ||
axios.get(BASE_URL.concat('folder/', params.id)) | ||
.then((response) => { | ||
this.setState(response.data.data); | ||
console.log(response.data) | ||
}) | ||
} | ||
|
||
render() { | ||
return ( | ||
<SingleFolder {...this.state} /> | ||
) | ||
} | ||
} | ||
|
||
export default Folder; |
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