RoomNavBar.jsx 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. import React from "react";
  2. import styled from "styled-components";
  3. import { useTranslation } from "react-i18next";
  4. import { ENABLE_WEBCONFERENCE } from "../../utils/settings";
  5. import useLocalStorage from "../../hooks/useLocalStorage";
  6. import useC2C from "../../hooks/useC2C";
  7. import Touch from "../../ui/Touch";
  8. import { UserList } from "../../components/users";
  9. import WebConferenceButton from "../../components/webconf/WebConferenceButton";
  10. import Brand from "../Brand";
  11. const StyledNavBar = styled.div.attrs(() => ({ className: "nav" }))`
  12. position: fixed;
  13. top: 0;
  14. width: 100%;
  15. z-index: 205;
  16. background-color: #19202ce0;
  17. box-shadow: 0px 3px 6px #00000029;
  18. color: var(--font-color);
  19. & .nav-center {
  20. display: relative;
  21. & h3 {
  22. position: absolute;
  23. top: 0;
  24. margin: 0;
  25. padding: 0 2em;
  26. background-color: var(--color-blueGrey);
  27. box-shadow: 0px 3px 6px #00000029;
  28. line-height: 90px;
  29. letter-spacing: 0px;
  30. font-size: 24px;
  31. text-transform: uppercase;
  32. transform: perspective(280px) rotateX(-20deg);
  33. }
  34. }
  35. & .nav-right,
  36. & .nav-center,
  37. & .nav-left {
  38. align-items: center;
  39. }
  40. & .nav-left {
  41. & > div {
  42. //flex: 1;
  43. padding-right: 1em;
  44. }
  45. padding-left: 40px;
  46. justify-content: flex-start;
  47. }
  48. & .nav-right {
  49. justify-content: flex-end;
  50. padding-right: 1em;
  51. gap: 1em;
  52. }
  53. & .spacer {
  54. flex: 1;
  55. max-width: 1em;
  56. }
  57. @media screen and (max-width: 640px) {
  58. & .nav-center h3 {
  59. position: relative;
  60. padding: 0;
  61. background-color: transparent;
  62. box-shadow: none;
  63. line-height: 1.2em;
  64. font-size: 1.2em;
  65. transform: none;
  66. }
  67. & .nav-right {
  68. display: none;
  69. }
  70. & .spacer {
  71. flex: 0;
  72. }
  73. & {
  74. flex-direction: row;
  75. }
  76. & .save {
  77. display: none;
  78. }
  79. & .info {
  80. margin: 0;
  81. padding: 0;
  82. width: 24px;
  83. height: 24px;
  84. }
  85. & .help {
  86. margin: 0;
  87. padding: 0;
  88. width: 24px;
  89. height: 24px;
  90. }
  91. & h3 {
  92. font-size: 1.2em;
  93. }
  94. & .nav-left {
  95. flex: 0;
  96. }
  97. }
  98. `;
  99. const RoomNavBar = () => {
  100. const { t } = useTranslation();
  101. const { room } = useC2C("room");
  102. const [showLink, setShowLink] = React.useState(false);
  103. const [isBeta] = useLocalStorage("isBeta", false);
  104. return (
  105. <StyledNavBar>
  106. <div className="nav-left">
  107. <Brand />
  108. </div>
  109. <div className="nav-center">
  110. <h3>{"Air Board Game"}</h3>
  111. </div>
  112. <div className="nav-right">
  113. <UserList />
  114. {
  115. <Touch
  116. onClick={() => {
  117. setShowLink(true);
  118. }}
  119. icon="add-user"
  120. title={t("Invite more player")}
  121. />
  122. }
  123. {ENABLE_WEBCONFERENCE && isBeta && <WebConferenceButton room={room} />}
  124. </div>
  125. </StyledNavBar>
  126. );
  127. };
  128. export default RoomNavBar;