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

Sanding UI #623

Merged
merged 3 commits into from
Oct 22, 2024
Merged
Show file tree
Hide file tree
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
3 changes: 3 additions & 0 deletions app/src/assets/icon-tablet.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 13 additions & 4 deletions app/src/components/AppBar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const AppBar = observer(() => {
'flex flex-row items-center pl-20 h-10 border-b bg-background dark:bg-background-active transition-colors duration-300 ease-in-out',
routeManager.route === Route.SIGN_IN && 'bg-transparent border-b-0',
updateManager.updateAvailable &&
'bg-red-950 transition-opacity duration-300 ease-in-out',
'bg-red-950 dark:bg-red-950 dark:text-red-300 text-red-300 transition-opacity duration-300 ease-in-out',
)}
>
<div className="appbar w-full h-full"></div>
Expand All @@ -36,7 +36,10 @@ const AppBar = observer(() => {
<Button
size="sm"
variant="ghost"
className={clsx(updateManager.updateAvailable && 'hover:bg-red-800')}
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider making a new button variant for red buttons?

className={clsx(
updateManager.updateAvailable &&
'hover:bg-red-800 hover:text-red-100 dark:hover:text-red-100',
)}
onClick={() => {
setTheme(nextTheme);
}}
Expand All @@ -53,7 +56,10 @@ const AppBar = observer(() => {
<Button
size="sm"
variant="ghost"
className={clsx(updateManager.updateAvailable && 'hover:bg-red-800')}
className={clsx(
updateManager.updateAvailable &&
'hover:bg-red-800 hover:text-red-100 dark:hover:text-red-100',
)}
onClick={() => {
window.open(Links.DISCORD, '_blank');
}}
Expand All @@ -68,7 +74,10 @@ const AppBar = observer(() => {
<Button
size="sm"
variant="ghost"
className={clsx(updateManager.updateAvailable && 'hover:bg-red-800')}
className={clsx(
updateManager.updateAvailable &&
'hover:bg-red-800 hover:text-red-100 dark:hover:text-red-100',
)}
onClick={() => {
window.open(Links.GITHUB, '_blank');
}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ const ProjectNameInput = observer(() => {
}
onKeyDown={handleKeyDown}
onBlur={handleRenameProject}
className="mx-0 max-w-[200px] px-1 py-0 h-6 text-foreground-onlook text-small"
className="mx-0 max-w-[200px] px-1 py-0 h-6 text-foreground-onlook text-small caret-red-500 selection:bg-red-500/50 placeholder:hover:text-red-500 selection:text-red-900 dark:selection:bg-red-500/50 dark:selection:text-red-200"
/>
) : (
<span
Expand Down
36 changes: 21 additions & 15 deletions app/src/routes/editor/WebviewArea/BrowserControl.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import {
DesktopIcon,
ExclamationTriangleIcon,
ExternalLinkIcon,
LaptopIcon,
MobileIcon,
MoonIcon,
ReloadIcon,
SunIcon,
Expand All @@ -35,6 +37,7 @@ interface SizePreset {
name: string;
width: number;
height: number;
icon: React.ReactNode;
}

function BrowserControls({
Expand All @@ -54,9 +57,9 @@ function BrowserControls({
const [isPopoverOpen, setIsPopoverOpen] = useState(false);

const PRESETS: SizePreset[] = [
{ name: 'Desktop', width: 1280, height: 832 },
{ name: 'Tablet', width: 834, height: 1194 },
{ name: 'Mobile', width: 320, height: 568 },
{ name: 'Desktop', width: 1440, height: 1024, icon: <DesktopIcon /> },
{ name: 'Laptop', width: 1280, height: 832, icon: <LaptopIcon /> },
{ name: 'Mobile', width: 320, height: 568, icon: <MobileIcon /> },
];

useEffect(() => {
Expand Down Expand Up @@ -163,21 +166,21 @@ function BrowserControls({
>
<Button
variant="outline"
className="bg-background-secondary/60"
className="bg-background-secondary/60 px-3"
onClick={goBack}
disabled={!canGoBack()}
>
<ArrowLeftIcon />
</Button>
<Button
variant="outline"
className="bg-background-secondary/60"
className="bg-background-secondary/60 px-3"
onClick={goForward}
disabled={!canGoForward()}
>
<ArrowRightIcon />
</Button>
<Button variant="outline" className="bg-background-secondary/60" onClick={reload}>
<Button variant="outline" className="bg-background-secondary/60 px-3" onClick={reload}>
<ReloadIcon />
</Button>
<Input
Expand All @@ -191,15 +194,15 @@ function BrowserControls({
<PopoverTrigger asChild>
<Button
variant="outline"
className="bg-background-secondary/60 flex items-center space-x-1"
className="bg-background-secondary/60 flex items-center space-x-1 p-3"
size="default"
>
<DesktopIcon />
<ChevronDownIcon />
</Button>
</PopoverTrigger>
<PopoverContent className="backdrop-blur text-sm overflow-hidden bg-background/90 rounded-xl w-64 border p-0">
<h3 className="text-foreground-tertiary px-4 py-4 border-b">
<PopoverContent className="backdrop-blur text-sm overflow-hidden bg-background/85 rounded-xl w-48 border p-0">
<h3 className="text-foreground-tertiary px-3 py-3 border-b text-smallPlus">
Preset Dimensions
</h3>
<div>
Expand All @@ -210,15 +213,18 @@ function BrowserControls({
resizeToPreset(preset.width, preset.height, preset.name)
}
className={clsx(
'w-full grid grid-cols-2 px-4 py-4 transition-colors duration-200',
'w-full flex flex-row gap-2 px-3 py-3 transition-colors duration-200 items-center',
selectedPreset === preset.name
? 'bg-background-active/80'
: 'bg-transparent',
'hover:bg-background-active/80',
? 'bg-background-tertiary text-foreground-primary'
: 'bg-transparent text-foreground-secondary',
'hover:bg-background-tertiary/50 hover:text-foreground-primary',
)}
>
<span className="justify-self-start">{preset.name}</span>
<span className="text-foreground-tertiary justify-self-end">{`${preset.width} x ${preset.height}`}</span>
{preset.icon}
<span className="justify-self-start text-smallPlus">
{preset.name}
</span>
<span className="text-foreground-tertiary text-mini">{`${preset.width} × ${preset.height}`}</span>
</button>
))}
</div>
Expand Down
2 changes: 1 addition & 1 deletion app/src/routes/editor/WebviewArea/Frame.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ const Frame = observer(
}

return (
<div className="flex flex-col space-y-4">
<div className="flex flex-col space-y-1.5">
<BrowserControls
webviewRef={webviewRef}
webviewSrc={webviewSrc}
Expand Down
6 changes: 3 additions & 3 deletions app/src/routes/editor/WebviewArea/ResizeHandles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,21 +66,21 @@ const ResizeHandles = observer(({ webviewSize, setWebviewSize }: ResizeHandlePro
className="flex items-center justify-center absolute -bottom-10 w-full cursor-s-resize h-10"
onMouseDown={(e) => startResize(e, [HandleType.Bottom])}
>
<div className="rounded bg-white w-32 h-1"></div>
<div className="rounded bg-foreground-primary w-32 h-1"></div>
</div>
<div
ref={resizeHandleRef}
className="flex items-center justify-center absolute -right-10 h-full cursor-e-resize w-10"
onMouseDown={(e) => startResize(e, [HandleType.Right])}
>
<div className="rounded bg-white w-1 h-32"></div>
<div className="rounded bg-foreground-primary w-1 h-32"></div>
</div>
<div
ref={resizeHandleRef}
className="flex items-center justify-center absolute -bottom-10 -right-10 cursor-se-resize w-10 h-10"
onMouseDown={(e) => startResize(e, [HandleType.Right, HandleType.Bottom])}
>
<div className="rounded bg-white w-2 h-2"></div>
<div className="rounded bg-foreground-primary w-2 h-2"></div>
</div>
</div>
);
Expand Down