diff --git a/package-lock.json b/package-lock.json
index c6a5590c..83ceee4c 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -34,6 +34,7 @@
"parse-color": "^1.0.0",
"parse-json": "^6.0.2",
"react": "^18.2.0",
+ "react-color": "^2.19.3",
"react-dom": "^18.2.0",
"react-helmet-async": "^1.3.0",
"react-router-dom": "^6.8.1"
@@ -45,6 +46,7 @@
"@types/parse-color": "^1.0.1",
"@types/parse-json": "^4.0.0",
"@types/react": "^18.0.15",
+ "@types/react-color": "^3.0.6",
"@types/react-dom": "^18.0.6",
"@typescript-eslint/eslint-plugin": "^5.52.0",
"@typescript-eslint/parser": "^5.52.0",
@@ -1049,6 +1051,14 @@
"integrity": "sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==",
"dev": true
},
+ "node_modules/@icons/material": {
+ "version": "0.2.4",
+ "resolved": "https://registry.npmjs.org/@icons/material/-/material-0.2.4.tgz",
+ "integrity": "sha512-QPcGmICAPbGLGb6F/yNf/KzKqvFx8z5qx3D1yFqVAjoFmXK35EgyW+cJ57Te3CNsmzblwtzakLGFqHPqrfb4Tw==",
+ "peerDependencies": {
+ "react": "*"
+ }
+ },
"node_modules/@jridgewell/gen-mapping": {
"version": "0.1.1",
"resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.1.1.tgz",
@@ -2254,6 +2264,16 @@
"csstype": "^3.0.2"
}
},
+ "node_modules/@types/react-color": {
+ "version": "3.0.6",
+ "resolved": "https://registry.npmjs.org/@types/react-color/-/react-color-3.0.6.tgz",
+ "integrity": "sha512-OzPIO5AyRmLA7PlOyISlgabpYUa3En74LP8mTMa0veCA719SvYQov4WLMsHvCgXP+L+KI9yGhYnqZafVGG0P4w==",
+ "dev": true,
+ "dependencies": {
+ "@types/react": "*",
+ "@types/reactcss": "*"
+ }
+ },
"node_modules/@types/react-dom": {
"version": "18.0.11",
"resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-18.0.11.tgz",
@@ -2263,6 +2283,15 @@
"@types/react": "*"
}
},
+ "node_modules/@types/reactcss": {
+ "version": "1.2.6",
+ "resolved": "https://registry.npmjs.org/@types/reactcss/-/reactcss-1.2.6.tgz",
+ "integrity": "sha512-qaIzpCuXNWomGR1Xq8SCFTtF4v8V27Y6f+b9+bzHiv087MylI/nTCqqdChNeWS7tslgROmYB7yeiruWX7WnqNg==",
+ "dev": true,
+ "dependencies": {
+ "@types/react": "*"
+ }
+ },
"node_modules/@types/scheduler": {
"version": "0.16.2",
"resolved": "https://registry.npmjs.org/@types/scheduler/-/scheduler-0.16.2.tgz",
@@ -5309,6 +5338,11 @@
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz",
"integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg=="
},
+ "node_modules/lodash-es": {
+ "version": "4.17.21",
+ "resolved": "https://registry.npmjs.org/lodash-es/-/lodash-es-4.17.21.tgz",
+ "integrity": "sha512-mKnC+QJ9pWVzv+C4/U3rRsHapFfHvQFoFB92e52xeyGMcX6/OlIl78je1u8vePzYZSkkogMPJ2yjxxsb89cxyw=="
+ },
"node_modules/lodash.merge": {
"version": "4.6.2",
"resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz",
@@ -5356,6 +5390,11 @@
"node": ">=12"
}
},
+ "node_modules/material-colors": {
+ "version": "1.2.6",
+ "resolved": "https://registry.npmjs.org/material-colors/-/material-colors-1.2.6.tgz",
+ "integrity": "sha512-6qE4B9deFBIa9YSpOc9O0Sgc43zTeVYbgDT5veRKSlB2+ZuHNoVVxA1L/ckMUayV9Ay9y7Z/SZCLcGteW9i7bg=="
+ },
"node_modules/merge2": {
"version": "1.4.1",
"resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz",
@@ -6061,6 +6100,23 @@
"node": ">=0.10.0"
}
},
+ "node_modules/react-color": {
+ "version": "2.19.3",
+ "resolved": "https://registry.npmjs.org/react-color/-/react-color-2.19.3.tgz",
+ "integrity": "sha512-LEeGE/ZzNLIsFWa1TMe8y5VYqr7bibneWmvJwm1pCn/eNmrabWDh659JSPn9BuaMpEfU83WTOJfnCcjDZwNQTA==",
+ "dependencies": {
+ "@icons/material": "^0.2.4",
+ "lodash": "^4.17.15",
+ "lodash-es": "^4.17.15",
+ "material-colors": "^1.2.1",
+ "prop-types": "^15.5.10",
+ "reactcss": "^1.2.0",
+ "tinycolor2": "^1.4.1"
+ },
+ "peerDependencies": {
+ "react": "*"
+ }
+ },
"node_modules/react-dom": {
"version": "18.2.0",
"resolved": "https://registry.npmjs.org/react-dom/-/react-dom-18.2.0.tgz",
@@ -6220,6 +6276,14 @@
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.5.0.tgz",
"integrity": "sha512-336iVw3rtn2BUK7ORdIAHTyxHGRIHVReokCR3XjbckJMK7ms8FysBfhLR8IXnAgy7T0PTPNBWKiH514FOW/WSg=="
},
+ "node_modules/reactcss": {
+ "version": "1.2.3",
+ "resolved": "https://registry.npmjs.org/reactcss/-/reactcss-1.2.3.tgz",
+ "integrity": "sha512-KiwVUcFu1RErkI97ywr8nvx8dNOpT03rbnma0SSalTYjkrPYaEajR4a/MRt6DZ46K6arDRbWMNHF+xH7G7n/8A==",
+ "dependencies": {
+ "lodash": "^4.0.1"
+ }
+ },
"node_modules/read-cache": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/read-cache/-/read-cache-1.0.0.tgz",
@@ -6782,6 +6846,11 @@
"integrity": "sha512-iyziEiyFxX4kyxSp+MtY1oCH/lvjH3PxFN8PGCDeqcZWAJ/i+9y+nL85w99PxVzrIvew/GSkSbDYtiGVa85Afg==",
"dev": true
},
+ "node_modules/tinycolor2": {
+ "version": "1.6.0",
+ "resolved": "https://registry.npmjs.org/tinycolor2/-/tinycolor2-1.6.0.tgz",
+ "integrity": "sha512-XPaBkWQJdsf3pLKJV9p4qN/S+fm2Oj8AIPo1BTUhg5oxkvm9+SVEGFdhyOz7tTdUTfvxMiAs4sp6/eZO2Ew+pw=="
+ },
"node_modules/tinypool": {
"version": "0.3.1",
"resolved": "https://registry.npmjs.org/tinypool/-/tinypool-0.3.1.tgz",
@@ -8138,6 +8207,12 @@
"integrity": "sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==",
"dev": true
},
+ "@icons/material": {
+ "version": "0.2.4",
+ "resolved": "https://registry.npmjs.org/@icons/material/-/material-0.2.4.tgz",
+ "integrity": "sha512-QPcGmICAPbGLGb6F/yNf/KzKqvFx8z5qx3D1yFqVAjoFmXK35EgyW+cJ57Te3CNsmzblwtzakLGFqHPqrfb4Tw==",
+ "requires": {}
+ },
"@jridgewell/gen-mapping": {
"version": "0.1.1",
"resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.1.1.tgz",
@@ -9001,6 +9076,16 @@
"csstype": "^3.0.2"
}
},
+ "@types/react-color": {
+ "version": "3.0.6",
+ "resolved": "https://registry.npmjs.org/@types/react-color/-/react-color-3.0.6.tgz",
+ "integrity": "sha512-OzPIO5AyRmLA7PlOyISlgabpYUa3En74LP8mTMa0veCA719SvYQov4WLMsHvCgXP+L+KI9yGhYnqZafVGG0P4w==",
+ "dev": true,
+ "requires": {
+ "@types/react": "*",
+ "@types/reactcss": "*"
+ }
+ },
"@types/react-dom": {
"version": "18.0.11",
"resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-18.0.11.tgz",
@@ -9010,6 +9095,15 @@
"@types/react": "*"
}
},
+ "@types/reactcss": {
+ "version": "1.2.6",
+ "resolved": "https://registry.npmjs.org/@types/reactcss/-/reactcss-1.2.6.tgz",
+ "integrity": "sha512-qaIzpCuXNWomGR1Xq8SCFTtF4v8V27Y6f+b9+bzHiv087MylI/nTCqqdChNeWS7tslgROmYB7yeiruWX7WnqNg==",
+ "dev": true,
+ "requires": {
+ "@types/react": "*"
+ }
+ },
"@types/scheduler": {
"version": "0.16.2",
"resolved": "https://registry.npmjs.org/@types/scheduler/-/scheduler-0.16.2.tgz",
@@ -11225,6 +11319,11 @@
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz",
"integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg=="
},
+ "lodash-es": {
+ "version": "4.17.21",
+ "resolved": "https://registry.npmjs.org/lodash-es/-/lodash-es-4.17.21.tgz",
+ "integrity": "sha512-mKnC+QJ9pWVzv+C4/U3rRsHapFfHvQFoFB92e52xeyGMcX6/OlIl78je1u8vePzYZSkkogMPJ2yjxxsb89cxyw=="
+ },
"lodash.merge": {
"version": "4.6.2",
"resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz",
@@ -11266,6 +11365,11 @@
"@jridgewell/sourcemap-codec": "^1.4.13"
}
},
+ "material-colors": {
+ "version": "1.2.6",
+ "resolved": "https://registry.npmjs.org/material-colors/-/material-colors-1.2.6.tgz",
+ "integrity": "sha512-6qE4B9deFBIa9YSpOc9O0Sgc43zTeVYbgDT5veRKSlB2+ZuHNoVVxA1L/ckMUayV9Ay9y7Z/SZCLcGteW9i7bg=="
+ },
"merge2": {
"version": "1.4.1",
"resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz",
@@ -11739,6 +11843,20 @@
"loose-envify": "^1.1.0"
}
},
+ "react-color": {
+ "version": "2.19.3",
+ "resolved": "https://registry.npmjs.org/react-color/-/react-color-2.19.3.tgz",
+ "integrity": "sha512-LEeGE/ZzNLIsFWa1TMe8y5VYqr7bibneWmvJwm1pCn/eNmrabWDh659JSPn9BuaMpEfU83WTOJfnCcjDZwNQTA==",
+ "requires": {
+ "@icons/material": "^0.2.4",
+ "lodash": "^4.17.15",
+ "lodash-es": "^4.17.15",
+ "material-colors": "^1.2.1",
+ "prop-types": "^15.5.10",
+ "reactcss": "^1.2.0",
+ "tinycolor2": "^1.4.1"
+ }
+ },
"react-dom": {
"version": "18.2.0",
"resolved": "https://registry.npmjs.org/react-dom/-/react-dom-18.2.0.tgz",
@@ -11845,6 +11963,14 @@
}
}
},
+ "reactcss": {
+ "version": "1.2.3",
+ "resolved": "https://registry.npmjs.org/reactcss/-/reactcss-1.2.3.tgz",
+ "integrity": "sha512-KiwVUcFu1RErkI97ywr8nvx8dNOpT03rbnma0SSalTYjkrPYaEajR4a/MRt6DZ46K6arDRbWMNHF+xH7G7n/8A==",
+ "requires": {
+ "lodash": "^4.0.1"
+ }
+ },
"read-cache": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/read-cache/-/read-cache-1.0.0.tgz",
@@ -12259,6 +12385,11 @@
"integrity": "sha512-iyziEiyFxX4kyxSp+MtY1oCH/lvjH3PxFN8PGCDeqcZWAJ/i+9y+nL85w99PxVzrIvew/GSkSbDYtiGVa85Afg==",
"dev": true
},
+ "tinycolor2": {
+ "version": "1.6.0",
+ "resolved": "https://registry.npmjs.org/tinycolor2/-/tinycolor2-1.6.0.tgz",
+ "integrity": "sha512-XPaBkWQJdsf3pLKJV9p4qN/S+fm2Oj8AIPo1BTUhg5oxkvm9+SVEGFdhyOz7tTdUTfvxMiAs4sp6/eZO2Ew+pw=="
+ },
"tinypool": {
"version": "0.3.1",
"resolved": "https://registry.npmjs.org/tinypool/-/tinypool-0.3.1.tgz",
diff --git a/package.json b/package.json
index 871a0c84..2e630aac 100644
--- a/package.json
+++ b/package.json
@@ -41,6 +41,7 @@
"parse-color": "^1.0.0",
"parse-json": "^6.0.2",
"react": "^18.2.0",
+ "react-color": "^2.19.3",
"react-dom": "^18.2.0",
"react-helmet-async": "^1.3.0",
"react-router-dom": "^6.8.1"
@@ -52,6 +53,7 @@
"@types/parse-color": "^1.0.1",
"@types/parse-json": "^4.0.0",
"@types/react": "^18.0.15",
+ "@types/react-color": "^3.0.6",
"@types/react-dom": "^18.0.6",
"@typescript-eslint/eslint-plugin": "^5.52.0",
"@typescript-eslint/parser": "^5.52.0",
diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs
index 8fa7821d..7661d108 100644
--- a/src-tauri/src/main.rs
+++ b/src-tauri/src/main.rs
@@ -1,6 +1,6 @@
#![cfg_attr(
- all(not(debug_assertions), target_os = "windows"),
- windows_subsystem = "windows"
+all(not(debug_assertions), target_os = "windows"),
+windows_subsystem = "windows"
)]
#[cfg(target_os = "macos")]
@@ -18,7 +18,7 @@ use sqlx::sqlite::SqlitePoolOptions;
use sqlx::types::Json;
use sqlx::{Pool, Sqlite};
use tauri::regex::Regex;
-use tauri::{AppHandle, State, Wry};
+use tauri::{AppHandle, Menu, MenuItem, State, Submenu, Wry};
use tauri::{CustomMenuItem, Manager, SystemTray, SystemTrayEvent, SystemTrayMenu, WindowEvent};
use tokio::sync::Mutex;
@@ -224,8 +224,8 @@ async fn update_request(
request.headers.0,
pool,
)
- .await
- .expect("Failed to update request");
+ .await
+ .expect("Failed to update request");
app_handle
.emit_all("updated_request", updated_request)
@@ -317,12 +317,19 @@ fn greet(name: &str) -> String {
}
fn main() {
- // here `"quit".to_string()` defines the menu item id, and the second parameter is the menu item label.
let quit = CustomMenuItem::new("quit".to_string(), "Quit");
let tray_menu = SystemTrayMenu::new().add_item(quit);
let system_tray = SystemTray::new().with_menu(tray_menu);
+ let submenu = Submenu::new("View", Menu::new()
+ .add_item(CustomMenuItem::new("zoom_reset".to_string(), "Zoom to Actual Size").accelerator("CmdOrCtrl+0"))
+ .add_item(CustomMenuItem::new("zoom_in".to_string(), "Zoom In").accelerator("CmdOrCtrl+Plus"))
+ .add_item(CustomMenuItem::new("zoom_out".to_string(), "Zoom Out").accelerator("CmdOrCtrl+-")),
+ );
+ let menu = Menu::new().add_native_item(MenuItem::Quit).add_submenu(submenu);
+
tauri::Builder::default()
+ .menu(menu)
.system_tray(system_tray)
.setup(|app| {
let win = app.get_window("main").unwrap();
@@ -360,9 +367,19 @@ fn main() {
window.hide().unwrap();
}
_ => {}
- }
+ };
}
})
+ .on_menu_event(|event| {
+ match event.menu_item_id() {
+ "quit" => std::process::exit(0),
+ "close" => event.window().close().unwrap(),
+ "zoom_reset" => event.window().emit("zoom", 0).unwrap(),
+ "zoom_in" => event.window().emit("zoom", 1).unwrap(),
+ "zoom_out" => event.window().emit("zoom", -1).unwrap(),
+ _ => {}
+ };
+ })
.on_window_event(|e| {
let apply_offset = || {
let win = e.window();
diff --git a/src-tauri/src/window_ext.rs b/src-tauri/src/window_ext.rs
index 5c719184..3b74cd5f 100644
--- a/src-tauri/src/window_ext.rs
+++ b/src-tauri/src/window_ext.rs
@@ -1,7 +1,7 @@
use tauri::{Runtime, Window};
const TRAFFIC_LIGHT_OFFSET_X: f64 = 15.0;
-const TRAFFIC_LIGHT_OFFSET_Y: f64 = 18.0;
+const TRAFFIC_LIGHT_OFFSET_Y: f64 = 22.0;
pub trait WindowExt {
#[cfg(target_os = "macos")]
diff --git a/src-web/App.tsx b/src-web/App.tsx
index 3fad7c11..2904ae9d 100644
--- a/src-web/App.tsx
+++ b/src-web/App.tsx
@@ -33,8 +33,8 @@ function App() {
{request.name}
diff --git a/src-web/components/Button.tsx b/src-web/components/Button.tsx
index ee000e8a..8537e0fa 100644
--- a/src-web/components/Button.tsx
+++ b/src-web/components/Button.tsx
@@ -1,65 +1,57 @@
import classnames from 'classnames';
-import type {
- ButtonHTMLAttributes,
- ComponentPropsWithoutRef,
- ElementType,
- ForwardedRef,
-} from 'react';
+import type { ButtonHTMLAttributes, ForwardedRef } from 'react';
import { forwardRef } from 'react';
import { Icon } from './Icon';
const colorStyles = {
- default: 'hover:bg-gray-700/10 text-gray-700 hover:text-gray-1000',
- gray: 'text-gray-800 bg-gray-100 hover:bg-gray-500/20 hover:text-gray-1000',
- primary: 'bg-blue-400 text-white',
- secondary: 'bg-violet-400 text-white',
- warning: 'bg-orange-400 text-white',
- danger: 'bg-red-400 text-white',
+ custom: '',
+ default: 'text-gray-700 enabled:hover:bg-gray-700/10 enabled:hover:text-gray-1000',
+ gray: 'text-gray-800 bg-gray-100 enabled:hover:bg-gray-500/20 enabled:hover:text-gray-1000',
+ primary: 'bg-blue-400 text-white hover:bg-blue-500',
+ secondary: 'bg-violet-400 text-white hover:bg-violet-500',
+ warning: 'bg-orange-400 text-white hover:bg-orange-500',
+ danger: 'bg-red-400 text-white hover:bg-red-500',
};
-export type ButtonProps = ButtonHTMLAttributes & {
+export type ButtonProps = ButtonHTMLAttributes & {
color?: keyof typeof colorStyles;
- size?: 'xs' | 'sm' | 'md';
+ size?: 'sm' | 'md';
justify?: 'start' | 'center';
forDropdown?: boolean;
- as?: T;
};
-export const Button = forwardRef(function Button(
+export const Button = forwardRef(function Button(
{
className,
- as,
- justify = 'center',
children,
- size = 'md',
forDropdown,
color,
+ justify = 'center',
+ size = 'md',
+ type = 'button',
...props
- }: ButtonProps & Omit, keyof ButtonProps>,
+ }: ButtonProps,
ref: ForwardedRef,
) {
- const Component = as || 'button';
return (
-
{children}
{forDropdown && }
-
+
);
});
diff --git a/src-web/components/ButtonLink.tsx b/src-web/components/ButtonLink.tsx
index c1931ed8..a3b8b6f8 100644
--- a/src-web/components/ButtonLink.tsx
+++ b/src-web/components/ButtonLink.tsx
@@ -1,10 +1,25 @@
+import classnames from 'classnames';
import type { LinkProps } from 'react-router-dom';
import { Link } from 'react-router-dom';
import type { ButtonProps } from './Button';
import { Button } from './Button';
-type Props = ButtonProps & LinkProps;
+type Props = ButtonProps & LinkProps;
-export function ButtonLink({ ...props }: Props) {
- return ;
+export function ButtonLink({
+ reloadDocument,
+ replace,
+ state,
+ preventScrollReset,
+ relative,
+ to,
+ className,
+ ...buttonProps
+}: Props) {
+ const linkProps = { reloadDocument, replace, state, preventScrollReset, relative, to };
+ return (
+
+
+
+ );
}
diff --git a/src-web/components/Dialog.tsx b/src-web/components/Dialog.tsx
index cc7e8856..cbe86a59 100644
--- a/src-web/components/Dialog.tsx
+++ b/src-web/components/Dialog.tsx
@@ -43,7 +43,7 @@ export function Dialog({
-
+
{title}
{description && {description}}
diff --git a/src-web/components/Editor/Editor.css b/src-web/components/Editor/Editor.css
index cb545a6d..ce5ef91e 100644
--- a/src-web/components/Editor/Editor.css
+++ b/src-web/components/Editor/Editor.css
@@ -25,19 +25,15 @@
}
.cm-gutters {
- @apply border-0 text-gray-500 text-opacity-30;
+ @apply border-0 text-gray-500/60;
.cm-gutterElement {
@apply cursor-default;
}
}
- &.cm-focused .cm-gutters {
- @apply text-opacity-60;
- }
-
.placeholder-widget {
- @apply text-[0.9em] text-gray-800 dark:text-gray-1000 px-1 rounded cursor-default dark:shadow;
+ @apply text-[0.9em] text-gray-800 dark:text-gray-900 px-1 rounded cursor-default dark:shadow;
/* NOTE: Background and border are translucent so we can see text selection through it */
@apply bg-gray-300/40 border border-gray-300 border-opacity-40 hover:border-opacity-80;
@@ -105,11 +101,12 @@
}
.cm-editor .fold-gutter-icon:hover {
- @apply text-gray-400 bg-gray-100/20;
+ @apply text-gray-900 bg-gray-300/50;
}
.cm-editor .cm-foldPlaceholder {
- @apply px-2 border border-gray-200 bg-gray-100;
+ @apply px-2 border border-gray-400/50 bg-gray-300/50 cursor-default;
+ @apply hover:text-gray-800 hover:border-gray-400;
}
.cm-editor .cm-activeLineGutter,
diff --git a/src-web/components/Editor/extensions.ts b/src-web/components/Editor/extensions.ts
index a9052a93..fdc8e618 100644
--- a/src-web/components/Editor/extensions.ts
+++ b/src-web/components/Editor/extensions.ts
@@ -34,7 +34,6 @@ import {
} from '@codemirror/view';
import { tags as t } from '@lezer/highlight';
import { debouncedAutocompletionDisplay } from './autocomplete';
-import { readOnlyTransactionFilter } from './readOnlyTransactionFilter';
import { twig } from './twig/extension';
import { url } from './url/extension';
diff --git a/src-web/components/HeaderEditor.tsx b/src-web/components/HeaderEditor.tsx
index 36a09df5..001a7808 100644
--- a/src-web/components/HeaderEditor.tsx
+++ b/src-web/components/HeaderEditor.tsx
@@ -106,7 +106,7 @@ function FormRow({
defaultValue={value}
onChange={onChangeValue}
/>
- {onDelete && }
+ {onDelete && }
{addSubmit && }
diff --git a/src-web/components/Icon.tsx b/src-web/components/Icon.tsx
index da0ae116..32a58196 100644
--- a/src-web/components/Icon.tsx
+++ b/src-web/components/Icon.tsx
@@ -4,11 +4,13 @@ import {
CheckIcon,
ClockIcon,
CodeIcon,
+ ColorWheelIcon,
Cross2Icon,
EyeOpenIcon,
GearIcon,
HomeIcon,
MoonIcon,
+ ListBulletIcon,
PaperPlaneIcon,
PlusCircledIcon,
PlusIcon,
@@ -19,59 +21,40 @@ import {
TriangleLeftIcon,
TriangleRightIcon,
UpdateIcon,
+ RowsIcon,
} from '@radix-ui/react-icons';
import classnames from 'classnames';
-import type { NamedExoticComponent } from 'react';
-type IconName =
- | 'archive'
- | 'home'
- | 'camera'
- | 'gear'
- | 'eye'
- | 'triangleDown'
- | 'triangleLeft'
- | 'triangleRight'
- | 'paperPlane'
- | 'update'
- | 'question'
- | 'check'
- | 'plus'
- | 'plusCircle'
- | 'clock'
- | 'sun'
- | 'code'
- | 'x'
- | 'trash'
- | 'moon';
-
-const icons: Record> = {
- paperPlane: PaperPlaneIcon,
- triangleDown: TriangleDownIcon,
- plus: PlusIcon,
- plusCircle: PlusCircledIcon,
- clock: ClockIcon,
+const icons = {
archive: ArchiveIcon,
camera: CameraIcon,
check: CheckIcon,
- triangleLeft: TriangleLeftIcon,
- triangleRight: TriangleRightIcon,
+ clock: ClockIcon,
+ code: CodeIcon,
+ colorWheel: ColorWheelIcon,
+ eye: EyeOpenIcon,
gear: GearIcon,
home: HomeIcon,
- update: UpdateIcon,
- sun: SunIcon,
+ listBullet: ListBulletIcon,
moon: MoonIcon,
- x: Cross2Icon,
+ paperPlane: PaperPlaneIcon,
+ plus: PlusIcon,
+ plusCircle: PlusCircledIcon,
question: QuestionMarkIcon,
- eye: EyeOpenIcon,
- code: CodeIcon,
+ rows: RowsIcon,
+ sun: SunIcon,
trash: TrashIcon,
+ triangleDown: TriangleDownIcon,
+ triangleLeft: TriangleLeftIcon,
+ triangleRight: TriangleRightIcon,
+ update: UpdateIcon,
+ x: Cross2Icon,
};
export interface IconProps {
- icon: IconName;
+ icon: keyof typeof icons;
className?: string;
- size?: 'md';
+ size?: 'xs' | 'sm' | 'md';
spin?: boolean;
}
@@ -83,6 +66,8 @@ export function Icon({ icon, spin, size = 'md', className }: IconProps) {
className,
'text-gray-800',
size === 'md' && 'h-4 w-4',
+ size === 'sm' && 'h-3 w-3',
+ size === 'xs' && 'h-2 w-2',
spin && 'animate-spin',
)}
/>
diff --git a/src-web/components/IconButton.tsx b/src-web/components/IconButton.tsx
index 9d83e6f0..bd5372e5 100644
--- a/src-web/components/IconButton.tsx
+++ b/src-web/components/IconButton.tsx
@@ -1,22 +1,20 @@
+import classnames from 'classnames';
import { forwardRef } from 'react';
-import type { IconProps } from './Icon';
-import { Icon } from './Icon';
import type { ButtonProps } from './Button';
import { Button } from './Button';
-import classnames from 'classnames';
+import type { IconProps } from './Icon';
+import { Icon } from './Icon';
-type Props = Omit &
- ButtonProps & {
- iconClassName?: string;
- };
+type Props = IconProps & ButtonProps & { iconClassName?: string; iconSize?: IconProps['size'] };
export const IconButton = forwardRef(function IconButton(
- { icon, spin, className, iconClassName, ...props }: Props,
+ { icon, spin, className, iconClassName, size, iconSize, ...props }: Props,
ref,
) {
return (
-