-
-
Notifications
You must be signed in to change notification settings - Fork 233
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
fix: Feed page responsiveness #1490
Conversation
β Deploy Preview for oss-insights ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify site configuration. |
β Deploy Preview for design-insights ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
Reviewing this @RitaDee... in the meantime do append the This way you should have...
|
@babblebey Done. |
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.
Great stuff @RitaDee, but your implementation isn't quite there yet... I have made the diagram below to guide you, it suggests some classes you should remove and ones to add...
Tasks
- Append the
container
andpx-2 md:px-16
classes to themain
element i.e. the first purple area in the diagram - Append/update the stated classes and remove the striked ones from the next nested
div
. - Do the same for the other
div
s. - Remove all fixed width from the
Left (userCard) div
andRight (filter) div
childrendiv
s replacing them withw-full
to allow them inherit width from their respective parentdiv
s.
Expected Behaviour
- The Central (feedInput form and feeds)
div
should have a flexible width, taking all available spaces in the center - The Left (userCard)
div
should take24%
width of the total viewport initially, but when screen size scales down below1280px
i.e. tailwindxl
, its display should benone
. - The Right (filter)
div
should also take24%
width of the total viewport initially, but when screen size scales down below1280px
i.e. tailwindxl
, its width should increase to30%
, at thesame point when theLeft (userCard) div
is no longer in display. - When screen size scales down below
1024px
i.e. tailwindlg
theRight (filter) div
display at this point should also benone
leaving only theCentral (feedInput form and feeds) div
on screen.
Potential Bottlenecks
- You might experience weird behaviour in the width of the
Left (userCard) div
andRight (filter) div
childrendiv
s, as seen below..
This is the intention of the Task No. 4
, (setting w-full
for child components) but you may not be able to fix some of this at the /feed
page level, requiring you to go into the source components instead. You can just skip going into the source components for now, do the things you can within the /feed
page for now...
Let's see the result of your Implementation first, then we can go fixing for the source component if needed.
We anticipate your screencast/demo after this!
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.
I noticed some of the things @babblebey mentioned. Marking requested changes for other reviewers.
Thank you, @babblebey for providing the diagram and the specific tasks to make the /feed page responsive. I have carefully reviewed the requirements, and I'll make the necessary changes as suggested. |
I acknowledge the suggestions provided by @babblebey. Thank you Update:I have improved the layout and styles of the /feed page to achieve a responsive design as outlined in the tasks provided. The changes focus on the main, left, and right sections, ensuring they adapt gracefully to different screen sizes. I applied the container and px-2 md:px-16 classes to the main element, allowing proper padding and responsiveness. Also, used the appropriate tailwind class to achieve this. Current behaviour:Screen.Recording.2023-08-06.at.22.50.22.mov |
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.
Thanks
This reverts commit 67662b2.
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.
Great work hey @RitaDee,
We have some few things to address.
@@ -8,7 +8,9 @@ const ProfileLayout = ({ children }: { children: React.ReactNode }) => { | |||
<div className="flex flex-col min-h-screen"> | |||
<TopNav /> | |||
<div className="page-container flex grow flex-col items-center"> | |||
<main className="flex pb-16 w-full flex-1 flex-col items-center bg-light-slate-2">{children}</main> | |||
<main className="container px-2 flex md:px-16 pb-16 w-full flex-1 flex-col items-center bg-light-slate-2"> |
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.
REGRESSION!!!
I see that the changes to the main
occured in the ProfileLayout
component, this will lead to Regression in other components where the ProfileLayout
is integrated. See pages/component where regression occurs below with screenshots
- The
/user/[username]
page integrates theProfileLayout
and it as regressed: https://deploy-preview-1490--oss-insights.netlify.app/user/babblebey/highlights
- The
/user/setting
page is the second component that integrates theProfileLayout
and it as also regressed: https://deploy-preview-1490--oss-insights.netlify.app/user/settings
This is due to the classes (container
, px-2
and md:px-16
) that we moved up into the component.
FIX!!
<main className="container px-2 flex md:px-16 pb-16 w-full flex-1 flex-col items-center bg-light-slate-2"> | |
<main className="flex pb-16 w-full flex-1 flex-col items-center bg-light-slate-2"> |
We will have to remove the classes (container
, px-2
and md:px-16
), from there moving it back to its initial place in the child div
.
> | ||
<div className="flex-col flex-1 hidden gap-6 mt-12 md:flex"> | ||
<div className="w-full gap-[2rem] justify-center flex flex-col md:gap-6 xl:gap-16 pt-12 md:flex-row" ref={topRef}> | ||
<div className="flex-col flex-1 xl:flex hidden gap-6 mt-12"> |
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.
<div className="flex-col flex-1 xl:flex hidden gap-6 mt-12"> | |
<div className="w-[24%] flex-col flex-none xl:flex hidden gap-6 mt-12"> |
You are missing a width
and flex-none
from the Left (userCard) div
.
With flex-none
, the goal is to size the Left (userCard) div
according to the width
(that you will have to set to 24%
), rendering it fully inflexible: so it neither shrinks nor grows in relation to its parent flex container.
In the absence of these we are have non equal width on the Right (Filter) Div
and Left (userCard) div
@@ -284,7 +281,7 @@ const Feeds: WithPageLayout<HighlightSSRProps> = (props: HighlightSSRProps) => { | |||
<FollowingHighlightWrapper selectedFilter={selectedRepo} emojis={emojis} /> | |||
</TabsContent> | |||
</Tabs> | |||
<div className="hidden gap-6 mt-10 md:flex-1 md:flex md:flex-col"> | |||
<div className="md:hidden gap-6 mt-10 md:flex-1 lg:flex md:flex-col"> |
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.
<div className="md:hidden gap-6 mt-10 md:flex-1 lg:flex md:flex-col"> | |
<div className="md:hidden gap-6 mt-10 w-[30%] lg:w-[24%] flex-none lg:flex md:flex-col"> |
You are also missing a responsive width
and flex-none
from the Right (Filter) Div
. for the same reason as Left (userCard) div
.
...and
<div className="md:hidden gap-6 mt-10 md:flex-1 lg:flex md:flex-col"> | |
<div className="hidden gap-6 mt-10 md:flex-1 lg:flex flex-col"> |
Tailwind uses a mobile-first breakpoint system.
This means that unprefixed classes (like hidden
) take effect on all screen sizes, while prefixed one (like lg:flex
) only take effect at the specified breakpoint (lg
in this case) and above.
So Right Filter Div
will be hidden
normally on all screen sizes and it will only be in display again at lg
(desktop) and above i.e. lg:flex
.
So you needn't specify a responsive class of md:hidden
since its gonna be hidden normally till lg
.
ref={topRef} | ||
> | ||
<div className="flex-col flex-1 hidden gap-6 mt-12 md:flex"> | ||
<div className="w-full gap-[2rem] justify-center flex flex-col md:gap-6 xl:gap-16 pt-12 md:flex-row" ref={topRef}> |
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.
<div className="w-full gap-[2rem] justify-center flex flex-col md:gap-6 xl:gap-16 pt-12 md:flex-row" ref={topRef}> | |
<div className="w-full gap-[2rem] justify-center flex flex-col pt-12 md:flex-row" ref={topRef}> |
The responsive/prefixed gap
classes are not affecting anything at those breakpoints (i.e. xl
and md
), because the flex items the points are already reduced leaving the gap
with nothing to space out.
So we can remove them.
{user && ( | ||
<div> | ||
<div className="md:w-1/2 lg:w-1/3"> |
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.
<div className="md:w-1/2 lg:w-1/3"> | |
<div className="w-full"> |
This should only take full width of the parent div
, not some fraction of it at breakpoints.
@@ -18,13 +18,13 @@ const UserCard = ({ username, name, meta, loading }: UserCardProps) => { | |||
const avatarUrl = getAvatarByUsername(username); | |||
|
|||
return ( | |||
<div className="w-full pb-6 border rounded-lg bg-light-slate-1 border-zinc-200"> | |||
<div className="pb-6 border bg-light-slate-1 w-max rounded-xl border-zinc-200"> |
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.
<div className="pb-6 border bg-light-slate-1 w-max rounded-xl border-zinc-200"> | |
<div className="pb-6 border bg-light-slate-1 w-full rounded-lg border-zinc-200"> |
Return the full width for the user-card
and the border-radius
component.
Why though!?
- The width
w-full
for size inheritance reason - The Border radius
rounded-lg
for uniformity reason, looking at all other sibling components/divs on theRight (Filter) Div
andLeft (userCard) div
.
{loading ? ( | ||
<div className="flex items-center justify-center h-32 w-72"> | ||
<Spinner className="mt-6 " /> | ||
</div> | ||
) : ( | ||
<div className="flex flex-col items-center gap-6 px-6 "> | ||
<div className="flex flex-col items-center gap-6 px-9"> |
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.
I'm very curious to know why you thought to increase this padding!?
## [1.59.0](v1.58.0...v1.59.0) (2023-08-08) ### π§βπ» Code Refactoring * replace supabase/ui in design system typography components ([#1438](#1438)) ([38cfb30](38cfb30)) ### π Features * add a user notifications page ([#1478](#1478)) ([022dc69](022dc69)) * add conditional routing to single highlight dialog close action ([#1473](#1473)) ([1341cba](1341cba)) * add github link to profile ([#1459](#1459)) ([d42bc6d](d42bc6d)) * add support for highlight.new ([#1487](#1487)) ([3daa5c0](3daa5c0)) * improved the UX on the feeds page and scroll behaviour ([#1506](#1506)) ([31c1593](31c1593)) * onboarding auto fetch timezone ([#1488](#1488)) ([ae5cdd7](ae5cdd7)) ### π Bug Fixes * Feed page responsiveness ([#1490](#1490)) ([67662b2](67662b2)) * feeds page typography and styles improvements ([#1467](#1467)) ([a3b289e](a3b289e)) * on page reload Insights page redirecting to Dashboard ([#1517](#1517)) ([397c36e](397c36e)) * update environment variable for Sentry ([#1521](#1521)) ([56ac14b](56ac14b)) * update release workflow to use GitHub app for semantic versioning ([#1484](#1484)) ([3f1ce84](3f1ce84)) * update user interest logo error for machine learning ([#1474](#1474)) ([a286eda](a286eda)) * uses session to update user info for notifications check ([#1486](#1486)) ([60d787e](60d787e))
Description
Fixes #1453
Fixes #1336
Duplicate to Issue #1336
What type of PR is this? (check all applicable)
Related Tickets & Documents
#1336
Mobile & Desktop Screenshots/Recordings
Before:
Screen.Recording.2023-07-31.at.19.11.01.mov
After:
Screen.Recording.2023-08-05.at.04.59.09.mov
Added tests?
Added to documentation?
[optional] Are there any post-deployment tasks we need to perform?
[optional] What gif best describes this PR or how it makes you feel?