GuessPane.jsx 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. import React from "react";
  2. import styled from "styled-components";
  3. import ClickMarkerMap from "./ClickMarkerMap";
  4. import RoundTimer from "../../util/Timer";
  5. import Button from "../../util/Button";
  6. const Container = styled.div`
  7. height: 100%;
  8. width: 100%;
  9. flex: 1;
  10. display: flex;
  11. flex-flow: row nowrap;
  12. justify-content: space-around;
  13. @media only screen and (min-width: 600px) and (min-height: 600px) {
  14. position: absolute;
  15. left: 10px;
  16. bottom: 10px;
  17. height: 200px;
  18. width: 200px;
  19. flex-flow: column-reverse nowrap;
  20. z-index: 1;
  21. opacity: .75;
  22. transition: 1s;
  23. &:hover {
  24. height: 400px;
  25. width: 400px;
  26. opacity: 1;
  27. transition: 0.5s;
  28. }
  29. }
  30. `
  31. const Map = styled.div`
  32. flex: 3;
  33. height: 100%;
  34. width: 100%;
  35. @media only screen and (min-width: 600px) and (min-height: 600px) {
  36. opacity: .75;
  37. transition: 1s;
  38. &:hover {
  39. opacity: 1;
  40. }
  41. }
  42. `
  43. const SubmitWrapper = styled.div`
  44. flex: 1;
  45. display: flex;
  46. flex-flow: column nowrap;
  47. justify-content: center;
  48. text-align: center;
  49. @media only screen and (min-width: 600px) and (min-height: 600px) {
  50. flex-flow: column-reverse nowrap;
  51. margin-top: 4px;
  52. color: #fff;
  53. &>.timer {
  54. background-color: #333;
  55. }
  56. }
  57. `
  58. const SubmitButton = styled(Button)`
  59. flex: 1;
  60. margin: 2px;
  61. @media only screen and (min-width: 600px) and (min-height: 600px) {
  62. margin: 0px;
  63. margin-bottom: 5px;
  64. ${Container} & {
  65. visibility: hidden;
  66. opacity: 0;
  67. transition: 1s;
  68. }
  69. ${Container}:hover & {
  70. visibility: visible;
  71. opacity: 1;
  72. transition: 0.5s;
  73. }
  74. }
  75. `
  76. export default ({
  77. roundSeconds,
  78. onTimeout,
  79. onSelectPoint,
  80. onSubmitGuess,
  81. submitDisabled,
  82. }) => (
  83. <Container>
  84. <Map>
  85. <ClickMarkerMap onMarkerMoved={onSelectPoint} />
  86. </Map>
  87. <SubmitWrapper>
  88. <RoundTimer seconds={roundSeconds} onTimeout={onTimeout} />
  89. <SubmitButton onClick={onSubmitGuess} disabled={submitDisabled}>
  90. Submit Guess
  91. </SubmitButton>
  92. </SubmitWrapper>
  93. </Container>
  94. );