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
Showing
4 changed files
with
69 additions
and
22 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 |
---|---|---|
|
@@ -10,6 +10,7 @@ | |
/build | ||
|
||
# misc | ||
.idea | ||
.DS_Store | ||
.env.local | ||
.env.development.local | ||
|
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,12 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> | ||
<xsl:template match="posts"> | ||
<xsl:for-each select="post"> | ||
<xsl:value-of select="id" /> | ||
<xsl:value-of select="name" /> | ||
<xsl:value-of select="message" /> | ||
<xsl:value-of select="parent_id" /> | ||
<xsl:value-of select="time" /> | ||
</xsl:for-each> | ||
</xsl:template> | ||
</xsl:stylesheet> |
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,27 +1,53 @@ | ||
import React from "react"; | ||
|
||
/*constructor(props) { | ||
this.onSubmit = this.onSubmit.bind(this); | ||
}*/ | ||
/* | ||
onSubmit(e) { | ||
fetch("http://localhost", { | ||
method: "delete", | ||
body: JSON.stringify(id) | ||
}) | ||
.then(res => res.json()) | ||
.then(res => { | ||
if (res.error) { | ||
this.setState({loading: false, error: res.error}); | ||
} else { | ||
} | ||
}) | ||
.catch(err => { | ||
this.setState({ | ||
error: "Something went wrong while deleting comment.", | ||
loading: false | ||
}); | ||
}); | ||
}*/ | ||
|
||
export default function Comment(props) { | ||
const { id, name, message, time, parent_id } = props.comment; | ||
const {id, name, message, time, parent_id} = props.comment; | ||
|
||
return ( | ||
<div className={parent_id > 0 ? "media mb-3 ml-5" : "media mb-3"} > | ||
<img | ||
className="mr-3 bg-light rounded" | ||
width="48" | ||
height="48" | ||
src={`https://api.adorable.io/avatars/48/${name.toLowerCase()}@adorable.io.png`} | ||
alt={name} | ||
/> | ||
return ( | ||
<div className={parent_id > 0 ? "media mb-3 ml-5" : "media mb-3"}> | ||
<img | ||
className="mr-3 bg-light rounded" | ||
width="48" | ||
height="48" | ||
src={`https://api.adorable.io/avatars/48/${name.toLowerCase()}@adorable.io.png`} | ||
alt={name} | ||
/> | ||
|
||
<div className="media-body p-2 shadow-sm rounded bg-light border"> | ||
<small className="float-right text-muted">#{id} ({time})</small> | ||
<h6 className="mt-0 mb-1 text-muted">{name}</h6> | ||
{message} | ||
<form> | ||
<button className ="btn btn-primary float-right text-white">💬 Comment</button> | ||
</form> | ||
</div> | ||
</div> | ||
); | ||
} | ||
<div className="media-body p-2 shadow-sm rounded bg-light border"> | ||
<small className="float-right text-muted">#{id} ({time})</small> | ||
<h6 className="mt-0 mb-1 text-muted">{name}</h6> | ||
{message} | ||
<form className="form-group" > | ||
<button className="btn btn-primary float-right text-white ml-3">❌ Delete</button> | ||
<button className="btn btn-primary float-right text-white ml-3">✏ Edit</button> | ||
<button className="btn btn-primary float-right text-white ml-3">💬 Comment</button> | ||
</form> | ||
</div> | ||
</div> | ||
); | ||
} |