Advertisement
Guest User

Untitled

a guest
Mar 28th, 2017
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.40 KB | None | 0 0
  1. import React, { Component } from 'react';
  2. import gear from './settings.svg';
  3. import copy from './copy-ico.png';
  4. import hide from './hide-ico.png';
  5. import login from './login-go.png'
  6. // import copy-a from './copy-active.png';
  7. // import view from './view-ico.png';
  8. // import gear-a from './setting-active.png';
  9. import './App.css';
  10.  
  11. class App extends Component {
  12. constructor(){
  13. super();
  14.  
  15. this.state={
  16. showOptions: false,
  17. }
  18.  
  19. this.items = [
  20. {name:"Edit",
  21. clickHandler : function (){
  22. alert("You clicked me!! Edit")
  23. }},
  24. {name:"Go to this Site",
  25. clickHandler : function (){
  26. alert("You clicked me!! Go to this Site")
  27. }},
  28. {name:"Delete",
  29. clickHandler : function (){
  30. alert("You clicked me!! Delete")
  31. }}
  32. ];
  33. }
  34. onClick(e){
  35. e.preventDefault();
  36. this.setState({showOptions: !this.state.showOptions})
  37. }
  38.  
  39. createItems(items){
  40.  
  41. let output = this.items.map((anItem, index) => <div className="Items" key={index} onClick={anItem.clickHandler}>{anItem.name}</div>);
  42. return output;
  43. }
  44.  
  45. render() {
  46. return (
  47. <div className="App">
  48.  
  49. <div className="tile-container">
  50. <div className="upper-container">
  51. <div className="title-box"></div>
  52. <div className="title-options">
  53. <div className="usr-pw">..........</div>
  54. <img src={hide} className="hide-img" alt="hide"></img>
  55. <img src={copy} className="copy-img" alt="copy"></img>
  56. <img src={login} className="login-img" alt="login"></img>
  57. </div>
  58. <div className="circle">Ar</div>
  59. </div>
  60. <div className="title-text">arandomnlyverylongstringgoeshere.com</div>
  61. <div className="email-box">
  62. <div className="email-text">janedoe@arandomnlyverylongstringgoeshere.com</div>
  63. <img src={gear} className="settings-img" alt="gear" onClick={this.onClick.bind(this)}/>
  64. {
  65. this.state.showOptions && <div className="options">
  66. <div className="values">
  67. {this.createItems(this.items)}
  68. </div>
  69. </div>
  70. }
  71. </div>
  72. </div>
  73. </div>
  74.  
  75.  
  76. );
  77. }
  78. }
  79.  
  80. export default App;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement