RoomNavBar.jsx 2.7 KB

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