Skip to content

Commit 969e65c

Browse files
committed
Start fix on mobile layout issues
1 parent c97ae4c commit 969e65c

File tree

7 files changed

+74
-6
lines changed

7 files changed

+74
-6
lines changed

streams-react/src/components/ChatContainer/ChatContainer.module.css

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@
22
position: fixed;
33
right: 0;
44
height: calc(100vh - 70px);
5-
width: 400px;
5+
/* width: 400px; */
6+
width: 20%;
7+
min-width: 400px;
8+
max-width: 500px;
69
background-color: #EEEEEE;
710
border: 2px solid #212121;
811
transform: translateX(100%);
@@ -50,6 +53,27 @@
5053
.hidden {
5154
display: none;
5255
}
56+
/*****
57+
MEDIA QUERIES
58+
*****/
59+
@media(max-width: 1200px) {
60+
.container {
61+
min-width: 350px;
62+
}
63+
}
64+
@media(max-width: 1000px) {
65+
.container {
66+
min-width: 300px;
67+
}
68+
}
69+
@media(max-width: 600px) {
70+
.container {
71+
min-width: none;
72+
max-width: none;
73+
width: 100%;
74+
z-index: 1;
75+
}
76+
}
5377
@keyframes rotateChevron {
5478
0% {
5579
transform: rotateZ(0deg);

streams-react/src/components/ChatHeader/ChatHeader.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,22 @@
11
import { useContext } from "react";
2+
import { ChatContext } from "../../context/ChatContext";
23
import { SocketContext } from "../../context/SocketContext";
34
import styles from "./ChatHeader.module.css";
45

56
const ChatHeader = () => {
67
const {users, roomName} = useContext(SocketContext);
8+
const {setIsChatOpen} = useContext(ChatContext);
79
const totalOnline = Object.keys(users).length;
810

11+
const handleClick = () => {
12+
setIsChatOpen(prev => !prev);
13+
};
14+
915
return(
1016
<div className={styles.container}>
17+
<button className={styles.close__button} onClick={handleClick}>
18+
<i className={`fas fa-times ${styles.close__icon}`}></i>
19+
</button>
1120
<h2 className={styles.chat__header}>{roomName}</h2>
1221
<p className={styles.chat__online}>Currently Online: {totalOnline}</p>
1322
</div>

streams-react/src/components/ChatHeader/ChatHeader.module.css

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
flex-direction: column;
44
justify-content: center;
55
align-items: center;
6+
position: relative;
67
border-bottom: 2px solid #212121;
78
padding: 5px;
89
padding-bottom: 10px;
@@ -14,16 +15,32 @@
1415
}
1516
.chat__header {
1617
display: -webkit-box;
17-
-webkit-line-clamp: 3;
18+
-webkit-line-clamp: 2;
1819
-webkit-box-orient: vertical;
1920
max-height: 100px;
2021
width: 100%;
2122
margin-top: 10px;
2223
margin-bottom: 10px;
24+
padding-right: 2em;
25+
padding-left: 2em;
2326
text-decoration: underline;
2427
overflow: hidden;
2528
text-align: center;
2629
}
2730
.chat__online {
2831
align-self: flex-start;
32+
}
33+
.close__button {
34+
position: absolute;
35+
top: 5px;
36+
right: 5px;
37+
color: #EEEEEE;
38+
cursor: pointer;
39+
transition: all 0.1s ease-out;
40+
}
41+
.close__button:hover, .close__button:focus {
42+
color: white;
43+
}
44+
.close__icon {
45+
font-size: 2em;
2946
}

streams-react/src/components/ChatInput/ChatInput.module.css

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,11 @@
5858
.send__button:focus {
5959
color: #00E676;
6060
}
61+
@media(max-width: 400px) {
62+
.emoji__mart {
63+
transform: translate(-77%, -105%);
64+
}
65+
}
6166
@keyframes sent {
6267
0% {
6368
transform: scale(1);

streams-react/src/components/HomeContainer/HomeContainer.module.css

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,14 @@
2424
box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);
2525
animation: fadeUp 0.55s ease-out;
2626
}
27+
/*****
28+
MEDIA QUERIES
29+
******/
30+
@media(max-width: 400px) {
31+
.forms {
32+
min-width: auto;
33+
}
34+
}
2735
/* Cool red color background-color: #DA3E52;*/
2836
@keyframes fadeUp {
2937
0% {

streams-react/src/components/RoomContainer/RoomContainer.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ const RoomContainer = () => {
2121
hasPeerError,
2222
hasSocketError
2323
} = useContext(SocketContext);
24-
const {isChatOpen} = useContext(ChatContext);
24+
const {isChatOpen, chatDimensions} = useContext(ChatContext);
2525
const location = useLocation();
2626
const [userName] = useStateToLocalStorage("userName");
2727
const [roomName, setRoomName] = useStateToLocalStorage("roomName");
@@ -43,7 +43,10 @@ const RoomContainer = () => {
4343
}, [setParams, roomID, location]);
4444

4545
return(
46-
<div className={`${styles.container} ${isChatOpen ? styles["container--shrink"] : ""}`}>
46+
<div
47+
className={styles.container}
48+
style={{paddingRight: isChatOpen ? chatDimensions.width : 0}}
49+
>
4750
<VideoRoomHeader room={hostRoomName ? hostRoomName : roomName} setRoomName={setRoomName} isHost={isHost} />
4851
<VideoContainer
4952
videos={videoStreams}

streams-react/src/components/RoomContainer/RoomContainer.module.css

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
min-height: calc(100vh - 70px);
66
background-color: #333745;
77
}
8-
.container--shrink {
9-
padding-right: 400px;
8+
@media(max-width: 600px) {
9+
.container {
10+
padding-right: 0 !important;
11+
}
1012
}

0 commit comments

Comments
 (0)