From 97a4e621173fba7392b33d40b297f9a39fabe945 Mon Sep 17 00:00:00 2001 From: tanvi chovatiya Date: Mon, 29 Sep 2025 20:50:58 +0530 Subject: [PATCH 1/2] =?UTF-8?q?User=20list=20hover=20effect=20(activeItem:?= =?UTF-8?q?hover)=20=E2=80=94=20improves=20interactivity.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../TextContainer/TextContainer.css | 60 ++++++++++++++----- .../components/TextContainer/TextContainer.js | 49 ++++++++------- 2 files changed, 69 insertions(+), 40 deletions(-) diff --git a/client/src/components/TextContainer/TextContainer.css b/client/src/components/TextContainer/TextContainer.css index 19aa5770..53c94420 100644 --- a/client/src/components/TextContainer/TextContainer.css +++ b/client/src/components/TextContainer/TextContainer.css @@ -1,33 +1,63 @@ .textContainer { display: flex; flex-direction: column; - margin-left: 100px; - color: white; - height: 60%; - justify-content: space-between; + justify-content: flex-start; + align-items: center; + padding: 1rem; + font-family: 'Arial', sans-serif; + color: #333; +} + +.intro h1 { + font-size: 1.8rem; + margin-bottom: 0.5rem; + text-align: center; +} + +.intro h2 { + font-size: 1.1rem; + margin-bottom: 0.5rem; + text-align: center; + color: #555; +} + +.usersSection { + margin-top: 2rem; + width: 100%; + max-width: 300px; } .activeContainer { display: flex; - align-items: center; - margin-bottom: 50%; + flex-direction: column; + gap: 0.5rem; + max-height: 200px; /* scroll if many users */ + overflow-y: auto; + padding: 0.5rem; + border: 1px solid #ddd; + border-radius: 0.5rem; + background-color: #f9f9f9; } .activeItem { display: flex; align-items: center; + gap: 0.5rem; + padding: 0.3rem 0.5rem; + border-radius: 0.3rem; + transition: background-color 0.2s ease; + cursor: default; } -.activeContainer img { - padding-left: 10px; +.activeItem:hover { + background-color: #e0f7ff; } -.textContainer h1 { - margin-bottom: 0px; +.onlineIcon { + width: 18px; + height: 18px; } -@media (min-width: 320px) and (max-width: 1200px) { - .textContainer { - display: none; - } -} \ No newline at end of file +.username { + font-weight: 500; +} diff --git a/client/src/components/TextContainer/TextContainer.js b/client/src/components/TextContainer/TextContainer.js index 94aeeaca..ef33eef7 100644 --- a/client/src/components/TextContainer/TextContainer.js +++ b/client/src/components/TextContainer/TextContainer.js @@ -1,36 +1,35 @@ import React from 'react'; - import onlineIcon from '../../icons/onlineIcon.png'; - import './TextContainer.css'; const TextContainer = ({ users }) => (
-
-

Realtime Chat Application 💬

-

Created with React, Express, Node and Socket.IO ❤️

-

Try it out right now! ⬅️

+
+

+ Realtime Chat Application 💬 +

+

+ Created with React, Express, Node and Socket.IO ❤️ +

+

+ Try it out right now! ⬅️ +

- { - users - ? ( -
-

People currently chatting:

-
-

- {users.map(({name}) => ( -
- {name} - Online Icon -
- ))} -

+ + {users && users.length > 0 && ( +
+

People currently chatting:

+
+ {users.map(({ name }) => ( +
+ Online Icon + {name}
-
- ) - : null - } + ))} +
+
+ )}
); -export default TextContainer; \ No newline at end of file +export default TextContainer; From 5b69962a438693bc4cd31cee6b9fefab79944537 Mon Sep 17 00:00:00 2001 From: tanvi chovatiya Date: Sun, 12 Oct 2025 16:03:26 +0530 Subject: [PATCH 2/2] Enhanced TextContainer CSS for better layout, responsiveness, and accessibility --- .../TextContainer/TextContainer.css | 78 +++++++++++++++---- 1 file changed, 61 insertions(+), 17 deletions(-) diff --git a/client/src/components/TextContainer/TextContainer.css b/client/src/components/TextContainer/TextContainer.css index 53c94420..46f6edac 100644 --- a/client/src/components/TextContainer/TextContainer.css +++ b/client/src/components/TextContainer/TextContainer.css @@ -1,3 +1,9 @@ +/* =========================== + TextContainer Styles + Updated for better clarity, + modern look, and accessibility + =========================== */ + .textContainer { display: flex; flex-direction: column; @@ -6,58 +12,96 @@ padding: 1rem; font-family: 'Arial', sans-serif; color: #333; + text-align: center; + background-color: #fafafa; + border-radius: 8px; + box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05); } +/* Intro Section */ .intro h1 { - font-size: 1.8rem; + font-size: 2rem; + font-weight: 600; margin-bottom: 0.5rem; - text-align: center; + color: #111; } .intro h2 { font-size: 1.1rem; margin-bottom: 0.5rem; - text-align: center; color: #555; } +/* Users Section */ .usersSection { margin-top: 2rem; width: 100%; - max-width: 300px; + max-width: 320px; } +/* Active User List Container */ .activeContainer { display: flex; flex-direction: column; - gap: 0.5rem; - max-height: 200px; /* scroll if many users */ + gap: 0.6rem; + max-height: 220px; overflow-y: auto; - padding: 0.5rem; - border: 1px solid #ddd; - border-radius: 0.5rem; - background-color: #f9f9f9; + padding: 0.7rem; + border: 1px solid #e2e2e2; + border-radius: 0.6rem; + background-color: #ffffff; + scrollbar-width: thin; + scrollbar-color: #ccc transparent; } +/* Scrollbar Styling for WebKit browsers */ +.activeContainer::-webkit-scrollbar { + width: 6px; +} +.activeContainer::-webkit-scrollbar-thumb { + background-color: #ccc; + border-radius: 3px; +} + +/* Individual Active Item */ .activeItem { display: flex; align-items: center; - gap: 0.5rem; - padding: 0.3rem 0.5rem; - border-radius: 0.3rem; - transition: background-color 0.2s ease; + gap: 0.6rem; + padding: 0.4rem 0.6rem; + border-radius: 0.4rem; + transition: background-color 0.2s ease, transform 0.1s ease; cursor: default; } .activeItem:hover { - background-color: #e0f7ff; + background-color: #e6f7ff; + transform: scale(1.02); } +/* Online Icon */ .onlineIcon { - width: 18px; - height: 18px; + width: 16px; + height: 16px; } +/* Username Text */ .username { font-weight: 500; + color: #222; +} + +/* Responsive Design */ +@media (max-width: 480px) { + .intro h1 { + font-size: 1.6rem; + } + + .usersSection { + max-width: 90%; + } + + .activeContainer { + max-height: 180px; + } }