Skip to content

Commit

Permalink
Fix: Scrollablity issue for discord users page
Browse files Browse the repository at this point in the history
  • Loading branch information
codeforstartups committed Jan 22, 2025
1 parent 1dc3328 commit 7c77f12
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 15 deletions.
20 changes: 14 additions & 6 deletions users/discord/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,20 @@ export const App = () => {
if (users.length)
return createElement('main', {}, [
TabsSection({ tabs, activeTab, handleTabNavigation }),
UsersSection({
users,
showUser,
handleUserSelected,
}),
UserDetailsSection({ user: users[showUser] ?? {} }),

// Scrollable users section
createElement('div', { class: 'users_section' }, [
UsersSection({
users,
showUser,
handleUserSelected,
}),
]),

// Fixed user details section
createElement('div', { class: 'user_details_section' }, [
UserDetailsSection({ user: users[showUser] ?? {} }),
]),
]);

return createElement('main', {}, [
Expand Down
1 change: 0 additions & 1 deletion users/discord/components/UserDetailsSection.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ export const UserDetailsSection = ({
return createElement(
'section',
{
class: 'user_details_section',
'data-testid': 'user-details-section',
},
[
Expand Down
19 changes: 11 additions & 8 deletions users/discord/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,7 @@ main {
grid-template-areas:
'tab tab '
'aside details';
}

.users_section {
grid-area: aside;
overflow: scroll;
padding-inline: 1rem;
height: 100%; /* Ensure full page height */
}

.tabs_section {
Expand All @@ -43,6 +38,13 @@ main {
border: 2px solid gray;
}

.users_section {
grid-area: aside;
overflow-y: auto;
padding-inline: 1rem;
max-height: 20rem;
}

.user_card {
padding: 1rem;
display: flex;
Expand All @@ -62,15 +64,16 @@ main {
}

.user_details_section {
grid-area: details;
padding: 1rem;
margin: 0 1rem;
background-color: var(--light-gray);
position: sticky;
height: 100%; /* Fill available space */
}

.user_details_field {
padding: 0.5rem;
}

.no_user_found {
width: 100vw;
text-align: center;
Expand Down

0 comments on commit 7c77f12

Please sign in to comment.