-
Notifications
You must be signed in to change notification settings - Fork 10
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
Mobile and tablet layouts #2087
base: main
Are you sure you want to change the base?
Changes from 18 commits
1a71958
55bba19
e55af0c
2dc1fda
fe6b9ba
6d83a8d
4a4c4d8
ea4caa0
05dc533
0c6cd0d
a6daccb
5a4592c
c78b142
c8945db
dc50b81
2bee8fd
e14fbfb
c22e049
1701b35
87a1049
2102b21
75dc134
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ | |
* | ||
* Copyright Oxide Computer Company | ||
*/ | ||
import { useState, type ReactNode } from 'react' | ||
import { useEffect, useState, type ReactNode } from 'react' | ||
|
||
import { Info16Icon, NextArrow12Icon } from '@oxide/design-system/icons/react' | ||
|
||
|
@@ -29,10 +29,18 @@ function ExternalLink({ href, children }: { href: string; children: ReactNode }) | |
export function MswBanner() { | ||
const [isOpen, setIsOpen] = useState(false) | ||
const closeModal = () => setIsOpen(false) | ||
|
||
useEffect(() => { | ||
document.body.classList.add('msw-banner') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Perhaps convoluted but only appears on the preview so not too concerned about it. We use it to add extra padding for the banner at the bottom. Banner has been moved to the bottom, mostly because it breaks less stuff in the navigation. |
||
|
||
return () => { | ||
document.body.classList.remove('msw-banner') | ||
} | ||
}, []) | ||
|
||
return ( | ||
<> | ||
{/* The [&+*]:pt-10 style is to ensure the page container isn't pushed out of screen as it uses 100vh for layout */} | ||
<label className="absolute z-topBar flex h-10 w-full items-center justify-center text-sans-md text-info-secondary bg-info-secondary [&+*]:pt-10"> | ||
<label className="fixed bottom-0 z-topBar flex h-10 w-full items-center justify-center text-sans-md text-info-secondary bg-info-secondary [&+*]:pt-[calc(--navigation-height)]"> | ||
<Info16Icon className="mr-2" /> This is a technical preview. | ||
<button | ||
className="ml-2 flex items-center gap-0.5 text-sans-md hover:text-info" | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,16 +5,20 @@ | |
* | ||
* Copyright Oxide Computer Company | ||
*/ | ||
import cn from 'classnames' | ||
import React from 'react' | ||
import { useNavigate } from 'react-router-dom' | ||
|
||
import { navToLogin, useApiMutation } from '@oxide/api' | ||
import { | ||
DirectionDownIcon, | ||
Info16Icon, | ||
MenuClose12Icon, | ||
MenuOpen12Icon, | ||
Profile16Icon, | ||
} from '@oxide/design-system/icons/react' | ||
|
||
import { closeSidebar, openSidebar, useMenuState } from '~/hooks/use-menu-state' | ||
import { useCurrentUser } from '~/layouts/AuthenticatedLayout' | ||
import { Button, buttonStyle } from '~/ui/lib/Button' | ||
import { DropdownMenu } from '~/ui/lib/DropdownMenu' | ||
|
@@ -39,27 +43,50 @@ export function TopBar({ children }: { children: React.ReactNode }) { | |
// picker is going to come in null when the user isn't supposed to see it | ||
const [cornerPicker, ...otherPickers] = React.Children.toArray(children) | ||
|
||
// The height of this component is governed by the `PageContainer` | ||
// It's important that this component returns two distinct elements (wrapped in a fragment). | ||
// Each element will occupy one of the top column slots provided by `PageContainer`. | ||
const { isOpen } = useMenuState() | ||
|
||
return ( | ||
<> | ||
<div className="flex items-center border-b border-r px-3 border-secondary"> | ||
<div className="fixed top-0 z-topBar col-span-2 grid h-[var(--navigation-height)] w-full grid-cols-[min-content,auto] bg-default lg+:grid-cols-[var(--sidebar-width),auto]"> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this stuff freaks me out. wonder if we can drop the grid cols thing |
||
<div className="flex items-center border-b pl-3 border-secondary lg+:border-r lg+:pr-3"> | ||
<Button | ||
variant="ghost" | ||
size="icon" | ||
className="mr-2 w-8 flex-shrink-0 lg+:hidden [&>*]:pointer-events-none" | ||
title="Sidebar" | ||
onClick={() => { | ||
if (isOpen) { | ||
closeSidebar() | ||
} else { | ||
openSidebar() | ||
} | ||
}} | ||
> | ||
{isOpen ? ( | ||
<MenuClose12Icon className="text-tertiary" /> | ||
) : ( | ||
<MenuOpen12Icon className="text-tertiary" /> | ||
)} | ||
</Button> | ||
|
||
{cornerPicker} | ||
</div> | ||
{/* Height is governed by PageContainer grid */} | ||
{/* shrink-0 is needed to prevent getting squished by body content */} | ||
<div className="z-topBar border-b bg-default border-secondary"> | ||
<div className="mx-3 flex h-[60px] shrink-0 items-center justify-between"> | ||
<div className="flex items-center">{otherPickers}</div> | ||
|
||
<div className="border-b bg-default border-secondary"> | ||
<div className="mr-3 flex h-[var(--navigation-height)] shrink-0 items-center justify-between lg+:ml-3"> | ||
<div className="pickers before:text-mono-lg flex items-center before:children:content-['/'] before:children:first:mx-3 before:children:first:text-quinary md-:children:hidden lg+:[&>div:first-of-type]:before:hidden md-:[&>div:last-of-type]:flex"> | ||
{otherPickers} | ||
</div> | ||
<div> | ||
<a | ||
id="topbar-info-link" | ||
href="https://docs.oxide.computer/guides" | ||
target="_blank" | ||
rel="noreferrer" | ||
aria-label="Link to documentation" | ||
className={buttonStyle({ size: 'icon', variant: 'secondary' })} | ||
className={cn( | ||
buttonStyle({ size: 'icon', variant: 'secondary' }), | ||
'md-:hidden' | ||
)} | ||
> | ||
<Info16Icon className="text-quaternary" /> | ||
</a> | ||
|
@@ -72,7 +99,7 @@ export function TopBar({ children }: { children: React.ReactNode }) { | |
size="sm" | ||
variant="secondary" | ||
aria-label="User menu" | ||
className="ml-2" | ||
className="ml-2 md-:hidden" | ||
innerClassName="space-x-2" | ||
> | ||
<Profile16Icon className="text-quaternary" /> | ||
|
@@ -92,7 +119,7 @@ export function TopBar({ children }: { children: React.ReactNode }) { | |
</DropdownMenu.Item> | ||
{loggedIn ? ( | ||
<DropdownMenu.Item onSelect={() => logout.mutate({})}> | ||
Sign out | ||
Sign Out | ||
</DropdownMenu.Item> | ||
) : ( | ||
<DropdownMenu.Item onSelect={() => navToLogin({ includeCurrent: true })}> | ||
|
@@ -104,6 +131,6 @@ export function TopBar({ children }: { children: React.ReactNode }) { | |
</div> | ||
</div> | ||
</div> | ||
</> | ||
</div> | ||
) | ||
} |
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.
Can be disabled universally I think. Users will not be using the CLI from their phones.