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.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  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 #999;
  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 #999;
  52. }
  53. .cell:last-child {
  54. border-right: 1px solid #999;
  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: 16px;
  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. flex: 1;
  79. justify-content: center;
  80. margin: 0.5em 0;
  81. }
  82. .size,
  83. .speed {
  84. align-items: center;
  85. display: flex;
  86. justify-content: center;
  87. }
  88. .button[disabled] {
  89. cursor: not-allowed;
  90. opacity: 0.6;
  91. }
  92. .controls .play {
  93. text-align: right;
  94. }
  95. .play .button {
  96. background: #347b20;
  97. }
  98. .play .button:hover {
  99. background: #4c9c36;
  100. color: white;
  101. }
  102. .reset .button {
  103. background: #7b2020;
  104. }
  105. .reset .button:hover {
  106. background: #9c3636;
  107. color: white;
  108. }
  109. .number-field {
  110. font-size: 16px;
  111. display: inline-block;
  112. margin-left: 0.25em;
  113. text-align: center;
  114. width: 50px;
  115. }
  116. .dimensions label {
  117. margin-right: 1em;
  118. }
  119. .play-reset {
  120. justify-content: flex-end;
  121. }
  122. .counter {
  123. padding: 1em;
  124. }