index.js 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. import React from 'react';
  2. import ReactDOM from "react-dom";
  3. import styled from 'styled-components';
  4. function Welcome(props) {
  5. return <h1>Hello, {props.name}</h1>;
  6. }
  7. function MenuButton(props) {
  8. const { item } = props
  9. return (
  10. <MenuItem title={item.title}>
  11. {item.title}
  12. </MenuItem>
  13. )
  14. }
  15. const MenuItem = styled.div`
  16. color: black;
  17. display: grid;
  18. grid-template-columns: 24px auto;
  19. align-items: center;
  20. padding: 10px;
  21. transition: 0.5s ease-out;
  22. border-radius: 10px;
  23. :hover {
  24. background: rgba(255, 255, 255, 0.1);
  25. box-shadow: 0px 10px 20px rgba(0, 0, 0, 0.1),
  26. inset 0px 0px 0px 0.5px rgba(255, 255, 255, 0.2);
  27. }
  28. `
  29. const array = [{ title: "Emil"}, { title: "Mihai"}, { title: "Paul"}]
  30. const value = JSON.parse(document.getElementById('count').textContent);
  31. const root = ReactDOM.createRoot(document.getElementById('root'));
  32. const element = <MenuButton item={ { title: "Emil"} } />;
  33. const element2 = array.map( (title) => <MenuButton item={title} />)
  34. root.render(element2);
  35. alert(value);