-
Notifications
You must be signed in to change notification settings - Fork 343
feat(interface): responsive mobile-friendly layout for the dashboard (#601) #602
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
Open
b-client-vm
wants to merge
7
commits into
spacedriveapp:main
Choose a base branch
from
brendandebeasi:feat/601-responsive-mobile
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 5 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
ae3fba6
feat(interface): add mobile responsive primitives (#601)
brendandebeasi 2a20a05
feat(interface): mobile shell — Sidebar becomes a drawer below md (#601)
brendandebeasi 105e92a
fix(opencode-embed): let the embed's native mobile layout surface (#601)
brendandebeasi 98df179
feat(workbench): mobile snap-scroll pager + drawer sidebar (#601)
brendandebeasi 5db884c
feat(interface): per-route mobile master-detail + drawers (#601)
brendandebeasi cb205c2
fix(interface): mobile follow-ups — Dashboard overflow + iOS auto-zoo…
brendandebeasi ba43543
fix(interface): mobile follow-ups round 2 (#601, #602 review)
brendandebeasi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| import {List} from "@phosphor-icons/react"; | ||
| import clsx from "clsx"; | ||
| import type {ReactNode} from "react"; | ||
|
|
||
| interface MobileTopBarProps { | ||
| title?: string; | ||
| onMenu: () => void; | ||
| leading?: ReactNode; | ||
| trailing?: ReactNode; | ||
| className?: string; | ||
| } | ||
|
|
||
| export function MobileTopBar({ | ||
| title, | ||
| onMenu, | ||
| leading, | ||
| trailing, | ||
| className, | ||
| }: MobileTopBarProps) { | ||
| return ( | ||
| <header | ||
| className={clsx( | ||
| "flex h-12 shrink-0 items-center gap-2 border-b border-app-line bg-sidebar px-2", | ||
| className, | ||
| )} | ||
| > | ||
| {leading ?? ( | ||
| <button | ||
| type="button" | ||
| aria-label="Open menu" | ||
| onClick={onMenu} | ||
| className="flex h-11 w-11 items-center justify-center rounded-lg text-ink hover:bg-app-box/60 active:bg-app-box/80" | ||
| > | ||
| <List size={20} weight="regular" /> | ||
| </button> | ||
| )} | ||
| <div className="min-w-0 flex-1 truncate text-sm font-medium text-ink"> | ||
| {title} | ||
| </div> | ||
| {trailing && <div className="flex items-center gap-1">{trailing}</div>} | ||
| </header> | ||
| ); | ||
| } |
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
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
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
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| import {useEffect, useState} from "react"; | ||
|
|
||
| export function useMediaQuery(query: string): boolean { | ||
| const getMatch = () => { | ||
| if (typeof window === "undefined") return false; | ||
| return window.matchMedia(query).matches; | ||
| }; | ||
|
|
||
| const [matches, setMatches] = useState<boolean>(getMatch); | ||
|
|
||
| useEffect(() => { | ||
| if (typeof window === "undefined") return; | ||
| const mql = window.matchMedia(query); | ||
| const handler = (e: MediaQueryListEvent) => setMatches(e.matches); | ||
| setMatches(mql.matches); | ||
| mql.addEventListener("change", handler); | ||
| return () => mql.removeEventListener("change", handler); | ||
| }, [query]); | ||
|
|
||
| return matches; | ||
| } | ||
|
|
||
| export function useIsMobile(): boolean { | ||
| return useMediaQuery("(max-width: 767px)"); | ||
| } |
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
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.