diff options
author | Ernst Widerberg <ernst@sunet.se> | 2022-06-03 14:57:34 +0200 |
---|---|---|
committer | Ernst Widerberg <ernst@sunet.se> | 2022-06-08 11:48:09 +0200 |
commit | a608586b2651a20c2eff52056a14afd19b1ba359 (patch) | |
tree | 60a8508c83438499d36a76cc96fbe59167ce58e8 | |
parent | 9eee73c4cb7ec2ffe9485e01d0191ac053e5605e (diff) |
Make functional: ListItem
-rw-r--r-- | src/components/ListItem.js | 78 |
1 files changed, 38 insertions, 40 deletions
diff --git a/src/components/ListItem.js b/src/components/ListItem.js index 65c9019..7209887 100644 --- a/src/components/ListItem.js +++ b/src/components/ListItem.js @@ -7,46 +7,44 @@ import dateFormat from "dateformat"; import { resultClassName } from "../util"; -class ListItem extends React.Component { - render() { - return ( - <tr - className="list-item" - variant="outlined" - sx={{ - display: "flex", - justifyContent: "space-between", - alignItems: "center", - paddingTop: "1em", - paddingBottom: "1em" - }} - onClick={() => (window.location = `/${this.props._id}`)} - > - <td>{dateFormat(this.props.timestamp, "isoUtcDateTime")}</td> - <td> - {this.props.ip}:{this.props.port} - </td> - <td>{this.props.domain}</td> - <td>{this.props.display_name}</td> - <td style={{ paddingRight: 0 }}> - <Card - className={resultClassName(this.props.result)} - variant="outlined" - > - {this.props.result.display_name} - </Card> - </td> - <td style={{ paddingLeft: 0 }}> - <Card className="reliability" variant="outlined"> - {this.props.result.reliability} - </Card> - </td> - <td> - <Button variant="contained">Re-scan</Button> - </td> - </tr> - ); - } +function ListItem(props) { + return ( + <tr + className="list-item" + variant="outlined" + sx={{ + display: "flex", + justifyContent: "space-between", + alignItems: "center", + paddingTop: "1em", + paddingBottom: "1em" + }} + onClick={() => (window.location = `/${props._id}`)} + > + <td>{dateFormat(props.timestamp, "isoUtcDateTime")}</td> + <td> + {props.ip}:{props.port} + </td> + <td>{props.domain}</td> + <td>{props.display_name}</td> + <td style={{ paddingRight: 0 }}> + <Card + className={resultClassName(props.result)} + variant="outlined" + > + {props.result.display_name} + </Card> + </td> + <td style={{ paddingLeft: 0 }}> + <Card className="reliability" variant="outlined"> + {props.result.reliability} + </Card> + </td> + <td> + <Button variant="contained">Re-scan</Button> + </td> + </tr> + ); } export default ListItem; |