fix(demo): make the page responsive and follow the theme control - #59
Open
sidgaikwad wants to merge 1 commit into
Open
fix(demo): make the page responsive and follow the theme control#59sidgaikwad wants to merge 1 commit into
sidgaikwad wants to merge 1 commit into
Conversation
Two problems, both in the demo's own chrome. styles.css had no @media query at all. The sidebar was a hard 240px that could not shrink, so on a 375px phone the editor got ~135px and the editor's own Save/Cancel controls were off-screen entirely. The sidebar now overlays the editor below 768px with a dismissable backdrop, and App.tsx starts it closed at those widths via matchMedia. The Light/Dark control drove options.theme but the page around it was hardcoded: html/body light, topbar and sidebar dark, preview card white. Switching to dark produced a dark editor in light chrome, and switching to light still left a permanently dark sidebar. All chrome colours now come from CSS custom properties keyed off a data-theme attribute that App.tsx sets from the same theme state the editor gets. Verified at 375x812 and 1280x800.
|
@sidgaikwad is attempting to deploy a commit to the Unlayer Team on Vercel. A member of the Team first needs to authorize it. |
Collaborator
|
In landscape mobile view, the saved preview grows taller than the viewport and its Close/Download controls disappear above the screen. Please constrain the preview height and keep its header accessible. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #39.
1. The demo was not responsive
styles.csscontained no@mediaquery at all..sidebarwas a hardwidth: 240px; flex-shrink: 0, so on a 375px phone the editor got ~135px — and becauseuseState(true)opened the sidebar by default, the first paint on mobile was the broken one.Before (375×812): sidebar occupied ~64% of the viewport, the editor was a sliver, and the editor's own Save/Cancel controls were off-screen entirely.
After (same viewport): sidebar starts closed, editor gets the full 375px, tool rail and Save/Cancel all reachable.
Below 768px the sidebar now overlays the editor (
position: absolute,min(280px, 85vw)) with a dismissable backdrop, rather than squeezing it.App.tsxstarts it closed at those widths viamatchMedia, keyed to the same breakpoint.Measured in the running demo:
falsetrueabsolute(overlay)static(in flow)display: noneDesktop layout is unchanged.
2. The theme control didn't theme the page
The Light/Dark selector drove
options.theme, but the surrounding page was hardcoded —html/bodylight,.topbarand.sidebardark,.previewwhite. Switching to dark gave a dark editor inside light chrome; switching to light still left a permanently dark sidebar. Since the demo is what people look at to judge whether theming works, it undersold it.All chrome colours now come from CSS custom properties keyed off a
data-themeattribute thatApp.tsxsets from the samethemestate the editor receives:Verification
Ran against the live demo at both viewports;
tsc --noEmitandvite buildclean; Prettier clean.