Advertisement
Guest User

Untitled

a guest
Feb 24th, 2018
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.42 KB | None | 0 0
  1. import React, { Component } from 'react';
  2. import namor from "namor";
  3. import "./index.css";
  4.  
  5. const range = len => {
  6. const arr = [];
  7. for (let i = 0; i < len; i++) {
  8. arr.push(i);
  9. }
  10. return arr;
  11. };
  12.  
  13. const newPerson = () => {
  14. const statusChance = Math.random();
  15. return {
  16. firstName: namor.generate({ words: 1, numbers: 0 }),
  17. lastName: namor.generate({ words: 1, numbers: 0 }),
  18. age: Math.floor(Math.random() * 30),
  19. visits: Math.floor(Math.random() * 100),
  20. progress: Math.floor(Math.random() * 100),
  21. status:
  22. statusChance > 0.66
  23. ? "relationship"
  24. : statusChance > 0.33 ? "complicated" : "single"
  25. };
  26. };
  27.  
  28. export function makeData(len = 5553) {
  29. return range(len).map(d => {
  30. return {
  31. ...newPerson(),
  32. children: range(10).map(newPerson)
  33. };
  34. });
  35. }
  36.  
  37. export const Logo = () =>
  38. <div style={{ margin: '1rem auto', display: 'flex', flexWrap: 'wrap', alignItems: 'center', justifyContent: 'center'}}>
  39. For more examples, visit {''}
  40. <br />
  41. <a href="https://github.com/react-tools/react-table" target="_blank">
  42. <img
  43. src="https://github.com/react-tools/media/raw/master/logo-react-table.png"
  44. style={{ width: `150px`, margin: ".5em auto .3em" }}
  45. />
  46. </a>
  47. </div>;
  48.  
  49. export const Tips = () =>
  50. <div style={{ textAlign: "center" }}>
  51. <em>Tip: Hold shift when sorting to multi-sort!</em>
  52. </div>;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement