Conway's Game of Life as a React web app
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

index.css 2.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. * {
  2. box-sizing: border-box;
  3. margin: 0;
  4. padding: 0;
  5. }
  6. body {
  7. margin: 0;
  8. font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
  9. 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
  10. sans-serif;
  11. -webkit-font-smoothing: antialiased;
  12. -moz-osx-font-smoothing: grayscale;
  13. }
  14. code {
  15. font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
  16. monospace;
  17. }
  18. .container {
  19. align-items: center;
  20. display: flex;
  21. height: 100vh;
  22. flex-direction: column;
  23. width: 100vw;
  24. }
  25. .controls {
  26. background: black;
  27. color: white;
  28. display: flex;
  29. padding: 1em;
  30. width: 100%;
  31. }
  32. .board-container {
  33. align-items: center;
  34. display: flex;
  35. flex: 1;
  36. justify-content: center;
  37. width: 100%;
  38. }
  39. .row {
  40. height: 30px;
  41. }
  42. .cell {
  43. border: 1px solid black;
  44. border-right: none;
  45. border-bottom: none;
  46. display: inline-block;
  47. height: 30px;
  48. width: 30px;
  49. }
  50. .row:last-child .cell {
  51. border-bottom: 1px solid black;
  52. }
  53. .cell:last-child {
  54. border-right: 1px solid black;
  55. }
  56. .cell.alive {
  57. background: black;
  58. }
  59. .cell.clickable {
  60. cursor: pointer;
  61. }
  62. .button {
  63. background: black;
  64. border: 1px solid white;
  65. color: white;
  66. cursor: pointer;
  67. font-size: 18px;
  68. margin-right: 1em;
  69. padding: 0.25em 0.5em;
  70. }
  71. .button:not([disabled]):hover {
  72. background: white;
  73. color: black;
  74. }
  75. .controls__section {
  76. align-items: center;
  77. display: flex;
  78. margin: 0.5em 0;
  79. }
  80. .speed {
  81. align-items: center;
  82. display: flex;
  83. flex: 1;
  84. justify-content: flex-end;
  85. }
  86. .button[disabled] {
  87. cursor: not-allowed;
  88. opacity: 0.6;
  89. }
  90. .controls .play {
  91. text-align: right;
  92. }
  93. .play .button {
  94. background: #347b20;
  95. }
  96. .play .button:hover {
  97. background: #4c9c36;
  98. color: white;
  99. }
  100. .reset .button {
  101. background: #7b2020;
  102. }
  103. .reset .button:hover {
  104. background: #9c3636;
  105. color: white;
  106. }
  107. .number-field {
  108. font-size: 16px;
  109. display: inline-block;
  110. margin-left: 0.25em;
  111. text-align: center;
  112. width: 50px;
  113. }
  114. .dimensions label {
  115. margin-right: 1em;
  116. }
  117. .play-reset {
  118. flex: 1;
  119. justify-content: flex-end;
  120. }