-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Improved Hero Section Design and Responsiveness #167
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,33 +1,107 @@ | ||
| /* =========================== | ||
| TextContainer Styles | ||
| Updated for better clarity, | ||
| modern look, and accessibility | ||
| =========================== */ | ||
|
|
||
| .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; | ||
| 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: 2rem; | ||
| font-weight: 600; | ||
| margin-bottom: 0.5rem; | ||
| color: #111; | ||
| } | ||
|
|
||
| .intro h2 { | ||
| font-size: 1.1rem; | ||
| margin-bottom: 0.5rem; | ||
| color: #555; | ||
| } | ||
|
|
||
| /* Users Section */ | ||
| .usersSection { | ||
| margin-top: 2rem; | ||
| width: 100%; | ||
| max-width: 320px; | ||
| } | ||
|
|
||
| /* Active User List Container */ | ||
| .activeContainer { | ||
| display: flex; | ||
| align-items: center; | ||
| margin-bottom: 50%; | ||
| flex-direction: column; | ||
| gap: 0.6rem; | ||
| max-height: 220px; | ||
| overflow-y: auto; | ||
| 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.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: #e6f7ff; | ||
| transform: scale(1.02); | ||
| } | ||
|
|
||
| .activeContainer img { | ||
| padding-left: 10px; | ||
| /* Online Icon */ | ||
| .onlineIcon { | ||
| width: 16px; | ||
| height: 16px; | ||
| } | ||
|
|
||
| .textContainer h1 { | ||
| margin-bottom: 0px; | ||
| /* Username Text */ | ||
| .username { | ||
| font-weight: 500; | ||
| color: #222; | ||
| } | ||
|
|
||
| @media (min-width: 320px) and (max-width: 1200px) { | ||
| .textContainer { | ||
| display: none; | ||
| /* Responsive Design */ | ||
| @media (max-width: 480px) { | ||
| .intro h1 { | ||
| font-size: 1.6rem; | ||
| } | ||
| } | ||
|
|
||
| .usersSection { | ||
| max-width: 90%; | ||
| } | ||
|
|
||
| .activeContainer { | ||
| max-height: 180px; | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,36 +1,35 @@ | ||
| import React from 'react'; | ||
|
|
||
| import onlineIcon from '../../icons/onlineIcon.png'; | ||
|
|
||
| import './TextContainer.css'; | ||
|
|
||
| const TextContainer = ({ users }) => ( | ||
| <div className="textContainer"> | ||
| <div> | ||
| <h1>Realtime Chat Application <span role="img" aria-label="emoji">💬</span></h1> | ||
| <h2>Created with React, Express, Node and Socket.IO <span role="img" aria-label="emoji">❤️</span></h2> | ||
| <h2>Try it out right now! <span role="img" aria-label="emoji">⬅️</span></h2> | ||
| <div className="intro"> | ||
| <h1> | ||
| Realtime Chat Application <span role="img" aria-label="chat">💬</span> | ||
| </h1> | ||
| <h2> | ||
| Created with React, Express, Node and Socket.IO <span role="img" aria-label="heart">❤️</span> | ||
| </h2> | ||
| <h2> | ||
| Try it out right now! <span role="img" aria-label="arrow">⬅️</span> | ||
| </h2> | ||
| </div> | ||
| { | ||
| users | ||
| ? ( | ||
| <div> | ||
| <h1>People currently chatting:</h1> | ||
| <div className="activeContainer"> | ||
| <h2> | ||
| {users.map(({name}) => ( | ||
| <div key={name} className="activeItem"> | ||
| {name} | ||
| <img alt="Online Icon" src={onlineIcon}/> | ||
| </div> | ||
| ))} | ||
| </h2> | ||
|
|
||
| {users && users.length > 0 && ( | ||
| <div className="usersSection"> | ||
| <h1>People currently chatting:</h1> | ||
| <div className="activeContainer"> | ||
| {users.map(({ name }) => ( | ||
| <div key={name} className="activeItem"> | ||
| <img alt="Online Icon" src={onlineIcon} className="onlineIcon" /> | ||
| <span className="username">{name}</span> | ||
| </div> | ||
| </div> | ||
| ) | ||
| : null | ||
| } | ||
| ))} | ||
| </div> | ||
| </div> | ||
| )} | ||
|
Comment on lines
+19
to
+31
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Critical: Type mismatch between users initialization and usage. In Apply this verification script to confirm how #!/bin/bash
# Description: Verify how users state is initialized and updated in Chat.js
# Find where users state is set
rg -A 3 'setUsers' client/src/components/Chat/Chat.js
# Check if users is expected to be an array elsewhere
ast-grep --pattern 'users.map'🤖 Prompt for AI Agents |
||
| </div> | ||
| ); | ||
|
|
||
| export default TextContainer; | ||
| export default TextContainer; | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider using a more unique key.
Using
nameas the React key assumes all usernames are unique. If duplicate names exist, React may have reconciliation issues. Consider using a unique identifier likeuserIdor falling back to an index if unavailable.Example approach:
Note: This requires updating the map callback to include the index parameter.
🤖 Prompt for AI Agents