Advertisement
Guest User

Untitled

a guest
Mar 26th, 2019
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.15 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html lang="pl">
  3.  
  4. <head>
  5. <meta charset="UTF-8">
  6. <title>Pierwszy komponent w React.js</title>
  7. <script src="https://unpkg.com/react/umd/react.development.js"></script>
  8. <script src="https://unpkg.com/react-dom/umd/react-dom.development.js"></script>
  9. <script src="https://unpkg.com/babel-standalone/babel.js"></script>
  10. </head>
  11. <body>
  12. <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.2.13/semantic.min.css">
  13. <div id="app"></div>
  14. <script type="text/babel">
  15. function AppHeader() {
  16. return (
  17. <header className="ui menu">
  18. <nav className="ui container">
  19. <a href="#" className="header item">
  20. <img
  21. className="logo"
  22. src="https://typeofweb.com/wp-content/uploads/2017/08/cropped-typeofweb_logo-04-white-smaller-1-e1504359870362.png"
  23. />
  24. Lista kontaktów
  25. </a>
  26. <div className="header item">
  27. <button className="ui button">Dodaj</button>
  28. </div>
  29. </nav>
  30. </header>
  31. );
  32. }
  33.  
  34. function ContactsList() {
  35. return (
  36. <ul className="ui relaxed divided list selection">
  37. <ContactItem
  38. login="typeofweb1"
  39. name="Lena"
  40. department="JavaScript Developer"
  41. />
  42. <ContactItem
  43. login="typeofweb2"
  44. name="Brian"
  45. department="Human Resources"
  46. />
  47. <ContactItem
  48. login="typeofweb3"
  49. name="Rick"
  50. department="QA"
  51. />
  52. </ul>
  53. );
  54. }
  55.  
  56. function ContactItem({ login, name, department }) {
  57. const imgUrl = `https://api.adorable.io/avatars/55/${login}.png`;
  58. return (
  59. <li className="item">
  60. <img src={imgUrl} className="ui mini rounded image" />
  61. <div className="content">
  62. <h4 className="header">{name}</h4>
  63. <div className="description">{department}</div>
  64. </div>
  65. </li>
  66. );
  67. }
  68.  
  69. function App() {
  70. return (
  71. <div>
  72. <AppHeader />
  73. <main className="ui main text container">
  74. <ContactsList />
  75. </main>
  76. </div>
  77. );
  78. }
  79. ReactDOM.render(<App />, document.getElementById("app"));
  80. </script>
  81.  
  82.  
  83. </body>
  84. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement