DocSpace-client/packages/asc-web-common/components/PageLayout/sub-components/room-info.js

113 lines
2.9 KiB
JavaScript
Raw Normal View History

2022-02-10 13:18:16 +00:00
import IconButton from "@appserver/components/icon-button";
import { mobile, tablet } from "@appserver/components/utils/device";
2022-02-10 15:52:27 +00:00
import PropTypes from "prop-types";
2022-02-10 13:18:16 +00:00
import { inject } from "mobx-react";
2022-02-09 09:13:16 +00:00
import React from "react";
import styled from "styled-components";
2022-02-10 13:18:16 +00:00
const RoomInfo = ({ children, isVisible, toggleIsVisible }) => {
2022-02-09 18:08:22 +00:00
if (!isVisible) return null;
2022-02-10 13:18:16 +00:00
const StyledRoomInfoWrapper = styled.div`
height: auto;
width: auto;
background: rgba(6, 22, 38, 0.2);
backdrop-filter: blur(18px);
@media ${tablet} {
z-index: 191;
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
}
`;
2022-02-09 09:13:16 +00:00
const StyledRoomInfo = styled.div`
height: 100%;
2022-02-10 13:18:16 +00:00
width: 368px;
2022-02-09 09:13:16 +00:00
background-color: #ffffff;
border-left: 1px solid #eceef1;
2022-02-10 13:18:16 +00:00
display: flex;
flex-direction: column;
align-items: center;
2022-02-10 15:52:27 +00:00
padding: 0 16px;
2022-02-10 13:18:16 +00:00
@media ${tablet} {
position: absolute;
border: none;
right: 0;
2022-02-10 15:52:27 +00:00
width: 448px;
max-width: calc(100vw - 69px);
2022-02-10 13:18:16 +00:00
}
@media ${mobile} {
bottom: 0;
height: 80%;
2022-02-10 15:52:27 +00:00
max-width: calc(100vw - 32px);
2022-02-10 13:18:16 +00:00
}
`;
const StyledCloseButtonWrapper = styled.div`
position: absolute;
display: none;
@media ${tablet} {
display: block;
top: 0;
left: 0;
margin-top: 18px;
margin-left: -27px;
}
@media ${mobile} {
right: 0;
left: auto;
margin-top: -27px;
margin-right: 10px;
}
2022-02-09 09:13:16 +00:00
`;
2022-02-10 13:18:16 +00:00
return (
<StyledRoomInfoWrapper>
<StyledRoomInfo>
<StyledCloseButtonWrapper>
<IconButton
onClick={toggleIsVisible}
2022-02-10 15:52:27 +00:00
iconName="/static/images/cross.react.svg"
2022-02-10 13:18:16 +00:00
size="17"
color="#ffffff"
hoverColor="#657077"
isFill={true}
className="room-info-button"
/>
</StyledCloseButtonWrapper>
{children}
</StyledRoomInfo>
</StyledRoomInfoWrapper>
);
2022-02-09 09:13:16 +00:00
};
2022-02-10 15:52:27 +00:00
RoomInfo.propTypes = {
children: PropTypes.oneOfType([
PropTypes.arrayOf(PropTypes.node),
PropTypes.node,
PropTypes.any,
]),
isVisible: PropTypes.bool,
toggleIsVisible: PropTypes.func,
};
2022-02-09 18:08:22 +00:00
export default inject(({ roomInfoStore }) => {
let isVisible = false;
2022-02-10 13:18:16 +00:00
let toggleIsVisible = () => {};
if (roomInfoStore) {
isVisible = roomInfoStore.isVisible;
toggleIsVisible = roomInfoStore.toggleIsVisible;
}
2022-02-09 18:08:22 +00:00
return {
isVisible,
2022-02-10 13:18:16 +00:00
toggleIsVisible,
2022-02-09 18:08:22 +00:00
};
})(RoomInfo);