RoomNavBar.jsx 3.0 KB

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