Skip to content
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

style: update overlay style on mobile #15760

Merged
merged 7 commits into from
Mar 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions packages/vite/src/client/overlay.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,11 @@ const template = /*html*/ `
.window {
font-family: var(--monospace);
line-height: 1.5;
width: 800px;
max-width: 80vw;
Copy link
Contributor

@chaejunlee chaejunlee Feb 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
max-width: 80vw;
width: 80vw;
max-width: 800px;

How about doing max-width: 800px; with width: 80vw;?
I believe that max-width should be a static value.
If we use max-width: 80vw;, it would expand infinitely and I believe it looks bad.

This applies to padding as well, however, I think we can use rem instead of px. What I found looked pretty good was padding: 1.5rem 2rem;

I am bringing up an extreme environment where screen width is 4000px wide, but I think you will get the point.

[visual viewport based]
Screenshot 2024-02-28 at 16 34 38

[max-width: 800px w/ rem padding]
Screenshot 2024-02-28 at 16 35 42

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now that I see here, I think it would be better to have the block margin of .window to be dynamic to viewport height, i.e. margin: 10vh auto

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the problem is that, the overlay error info is not designed for Flexible screen, if U use big screen, the main problem maybe the font-size;

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the problem is that, the overlay error info is not designed for Flexible screen, if U use big screen, the main problem maybe the font-size;

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I get what you mean, but as we are introducing this change to support mobile viewport, we should consider the wider viewport as well.

If you think my opinion is unrelated to your PR, I will open another PR after this one being merged and continue the discussion! 😊

color: var(--window-color);
box-sizing: border-box;
margin: 30px auto;
padding: 25px 40px;
padding: 2.5vh 4vw;
position: relative;
background: var(--window-background);
border-radius: 6px 6px 8px 8px;
Expand Down