diff --git a/src-web/App.tsx b/src-web/App.tsx
index d3f18c35..d6817500 100644
--- a/src-web/App.tsx
+++ b/src-web/App.tsx
@@ -2,7 +2,7 @@ import { useState } from 'react';
import { invoke } from '@tauri-apps/api/tauri';
import Editor from './components/Editor/Editor';
import { HStack, VStack } from './components/Stacks';
-import { DropdownMenuRadio } from './components/Dropdown';
+import { Dropdown, DropdownMenuRadio } from './components/Dropdown';
import { WindowDragRegion } from './components/WindowDragRegion';
import { IconButton } from './components/IconButton';
import { Sidebar } from './components/Sidebar';
@@ -50,25 +50,10 @@ function App() {
return (
<>
-
-
-
-
-
-
-
-
+
-
+
+
+
+
-
-
- {response?.method.toUpperCase()}
- •
- {response?.status}
- •
- {response?.elapsed}ms •
- {response?.elapsed2}ms
-
-
+
+ {response && (
+
+ {response.method.toUpperCase()}
+ •
+ {response.status}
+ •
+ {response.elapsed}ms •
+ {response.elapsed2}ms
+
+ )}
+ setResponse(null),
+ disabled: !response,
+ },
+ {
+ label: 'Other Thing',
+ },
+ ]}
+ >
+
+
-
+
{error && {error}
}
{response !== null && (
<>
diff --git a/src-web/components/Dropdown.tsx b/src-web/components/Dropdown.tsx
index a510c4dc..75cd8059 100644
--- a/src-web/components/Dropdown.tsx
+++ b/src-web/components/Dropdown.tsx
@@ -56,76 +56,26 @@ export function DropdownMenuRadio({
);
}
-export function Dropdown() {
- const [bookmarksChecked, setBookmarksChecked] = useState(true);
- const [urlsChecked, setUrlsChecked] = useState(false);
- const [person, setPerson] = useState('pedro');
+export interface DropdownProps {
+ children: ReactNode;
+ items: {
+ label: string;
+ onSelect?: () => void;
+ disabled?: boolean;
+ }[];
+}
+export function Dropdown({ children, items }: DropdownProps) {
return (
-
-
-
-
+ {children}
- ⌘T}>New Tab
- ⌘N}>New Window
- ⇧⌘N}>
- New Private Window
-
-
- }>
- More Tools
-
-
-
- ⌘S}>Save Page As…
- Create Shortcut…
- Name Window…
-
- Developer Tools
-
-
-
-
-
-
- setBookmarksChecked(!!v)}
- rightSlot={⌘B}
- leftSlot={
-
-
-
- }
- >
- Show Bookmarks
-
- setUrlsChecked(!!v)}
- leftSlot={
-
-
-
- }
- >
- Show Full URLs
-
-
-
-
- People
-
- Pedro Duarte
-
- Colm Tuite
-
-
+ {items.map((item, i) => (
+ item.onSelect?.()} disabled={item.disabled}>
+ {item.label}
+
+ ))}
@@ -157,7 +107,7 @@ const DropdownMenuContent = forwardRef
{children}
@@ -173,12 +123,14 @@ function DropdownMenuItem({
rightSlot,
className,
children,
+ disabled,
...props
}: DropdownMenuItemProps) {
return (
@@ -311,7 +263,7 @@ const ItemInner = forwardRef(function ItemInner(
)}
{...props}
>
- {leftSlot}
+ {leftSlot && {leftSlot}
}
{children}
{rightSlot && {rightSlot}
}
diff --git a/src-web/components/Icon.tsx b/src-web/components/Icon.tsx
index d1b1c7a4..ce2cbc1a 100644
--- a/src-web/components/Icon.tsx
+++ b/src-web/components/Icon.tsx
@@ -3,14 +3,25 @@ import {
CameraIcon,
GearIcon,
HomeIcon,
+ MoonIcon,
PaperPlaneIcon,
+ SunIcon,
TriangleDownIcon,
UpdateIcon,
} from '@radix-ui/react-icons';
import classnames from 'classnames';
import { NamedExoticComponent } from 'react';
-type IconName = 'archive' | 'home' | 'camera' | 'gear' | 'triangle-down' | 'paper-plane' | 'update';
+type IconName =
+ | 'archive'
+ | 'home'
+ | 'camera'
+ | 'gear'
+ | 'triangle-down'
+ | 'paper-plane'
+ | 'update'
+ | 'sun'
+ | 'moon';
const icons: Record> = {
'paper-plane': PaperPlaneIcon,
@@ -20,6 +31,8 @@ const icons: Record> = {
gear: GearIcon,
home: HomeIcon,
update: UpdateIcon,
+ sun: SunIcon,
+ moon: MoonIcon,
};
export interface IconProps {
diff --git a/src-web/components/Input.tsx b/src-web/components/Input.tsx
index 7627a39c..90b24797 100644
--- a/src-web/components/Input.tsx
+++ b/src-web/components/Input.tsx
@@ -47,7 +47,7 @@ export function Input({
id={id}
className={classnames(
className,
- 'bg-transparent min-w-0 pl-3 pr-2 w-full focus:outline-none',
+ 'bg-transparent min-w-0 pl-3 pr-2 w-full focus:outline-none text-gray-900',
leftSlot && 'pl-1',
rightSlot && 'pr-1',
size === 'md' && 'h-10',
diff --git a/src-web/components/Sidebar.tsx b/src-web/components/Sidebar.tsx
index dadb15c1..fd2a2131 100644
--- a/src-web/components/Sidebar.tsx
+++ b/src-web/components/Sidebar.tsx
@@ -1,32 +1,22 @@
-import { HTMLAttributes } from 'react';
+import React, { HTMLAttributes } from 'react';
import classnames from 'classnames';
+import { IconButton } from './IconButton';
+import { Button } from './Button';
+import useTheme from '../hooks/useTheme';
import { HStack } from './Stacks';
import { WindowDragRegion } from './WindowDragRegion';
-import { IconButton } from './IconButton';
-import { DropdownMenuRadio } from './Dropdown';
-import { Button } from './Button';
-type Props = HTMLAttributes;
+type Props = Omit, 'children'>;
export function Sidebar({ className, ...props }: Props) {
+ const { toggleTheme } = useTheme();
return (
-
-
-
-
-
+
+
{[1, 2, 3, 4, 5, 6, 7, 8, 9, 10].map((i) => (
diff --git a/src-web/components/UrlBar.tsx b/src-web/components/UrlBar.tsx
index 6d0cf62a..8f61d404 100644
--- a/src-web/components/UrlBar.tsx
+++ b/src-web/components/UrlBar.tsx
@@ -28,7 +28,7 @@ export function UrlBar({ sendRequest, onMethodChange, method, onUrlChange, url }
};
return (
-