Skip to content

#1 PDF Application on GitHub that lets you edit PDFs on any device anywhere

Size the form editor's field-type icons (#8042)

EthanHealy016bd9d8b6d65f
diff --git a/frontend/editor/src/core/tools/formFill/FormFieldCreatePanel.tsx b/frontend/editor/src/core/tools/formFill/FormFieldCreatePanel.tsx
index 353efbe35e..c6587956aa 100644
--- a/frontend/editor/src/core/tools/formFill/FormFieldCreatePanel.tsx
+++ b/frontend/editor/src/core/tools/formFill/FormFieldCreatePanel.tsx
@@ -124,7 +124,7 @@ export function FormFieldCreatePanel({
key={type}
size="sm"
variant={armed ? "primary" : "secondary"}
- leftSection={FIELD_TYPE_ICON[type]}
+ leftSection={<Icon name={FIELD_TYPE_ICON[type]} size={16} />}
onClick={() => setCreationType(armed ? null : type)}
data-testid={`form-create-type-${type}`}
>
@@ -192,7 +192,7 @@ export function FormFieldCreatePanel({
display: "flex",
}}
>
- {FIELD_TYPE_ICON[pf.type]}
+ <Icon name={FIELD_TYPE_ICON[pf.type]} size={16} />
</span>
<Text size="xs" truncate>
{pf.name}
diff --git a/frontend/editor/src/core/tools/formFill/FormFieldModifyPanel.tsx b/frontend/editor/src/core/tools/formFill/FormFieldModifyPanel.tsx
index a841024353..5af6f6df3e 100644
--- a/frontend/editor/src/core/tools/formFill/FormFieldModifyPanel.tsx
+++ b/frontend/editor/src/core/tools/formFill/FormFieldModifyPanel.tsx
@@ -300,7 +300,10 @@ export function FormFieldModifyPanel({
display: "flex",
}}
>
- {FIELD_TYPE_ICON[field.type]}
+ <Icon
+ name={FIELD_TYPE_ICON[field.type]}
+ size={16}
+ />
</span>
<Text
size="xs"
diff --git a/frontend/editor/src/core/tools/formFill/FormFieldSidebar.tsx b/frontend/editor/src/core/tools/formFill/FormFieldSidebar.tsx
index 8c05faee22..4d9ae167ab 100644
--- a/frontend/editor/src/core/tools/formFill/FormFieldSidebar.tsx
+++ b/frontend/editor/src/core/tools/formFill/FormFieldSidebar.tsx
@@ -165,10 +165,12 @@ export function FormFieldSidebar({ visible, onToggle }: FormFieldSidebarProps) {
className={styles.fieldTypeIcon}
style={{
color: `var(--mantine-color-${FIELD_TYPE_COLOR[field.type]}-6)`,
- fontSize: "0.875rem",
}}
>
- {FIELD_TYPE_ICON[field.type]}
+ <Icon
+ name={FIELD_TYPE_ICON[field.type]}
+ size={14}
+ />
</span>
</Tooltip>
<span className={styles.fieldName}>
diff --git a/frontend/editor/src/core/tools/formFill/FormFill.tsx b/frontend/editor/src/core/tools/formFill/FormFill.tsx
index 20e5ac8f88..4dbc5685ac 100644
--- a/frontend/editor/src/core/tools/formFill/FormFill.tsx
+++ b/frontend/editor/src/core/tools/formFill/FormFill.tsx
@@ -736,10 +736,12 @@ const FormFill = (_props: BaseToolProps) => {
className={styles.fieldTypeIcon}
style={{
color: `var(--mantine-color-${FIELD_TYPE_COLOR[field.type]}-6)`,
- fontSize: "0.875rem",
}}
>
- {FIELD_TYPE_ICON[field.type]}
+ <Icon
+ name={FIELD_TYPE_ICON[field.type]}
+ size={14}
+ />
</span>
<span className={styles.fieldName}>
{field.label || field.name}
diff --git a/frontend/editor/src/core/tools/formFill/fieldMeta.ts b/frontend/editor/src/core/tools/formFill/fieldMeta.ts
new file mode 100644
index 0000000000..5728d18413
--- /dev/null
+++ b/frontend/editor/src/core/tools/formFill/fieldMeta.ts
@@ -0,0 +1,26 @@
+/**
+ * Shared field type metadata: icons and color mappings.
+ * Used by FormFill, FormFieldSidebar, and any future form tools.
+ */
+import type { FormFieldType } from "@app/tools/formFill/types";
+import type { IconName } from "@app/ui/Icon";
+
+export const FIELD_TYPE_ICON: Record<FormFieldType, IconName> = {
+ text: "type",
+ checkbox: "square-check",
+ combobox: "circle-chevron-down",
+ listbox: "list",
+ radio: "radio-checked",
+ button: "pen-tool",
+ signature: "pen-tool",
+};
+
+export const FIELD_TYPE_COLOR: Record<FormFieldType, string> = {
+ text: "blue",
+ checkbox: "green",
+ combobox: "violet",
+ listbox: "cyan",
+ radio: "orange",
+ button: "gray",
+ signature: "pink",
+};
diff --git a/frontend/editor/src/core/tools/formFill/fieldMeta.tsx b/frontend/editor/src/core/tools/formFill/fieldMeta.tsx
deleted file mode 100644
index 432f556abe..0000000000
--- a/frontend/editor/src/core/tools/formFill/fieldMeta.tsx
+++ /dev/null
@@ -1,26 +0,0 @@
-/**
- * Shared field type metadata: icons and color mappings.
- * Used by FormFill, FormFieldSidebar, and any future form tools.
- */
-import React from "react";
-import type { FormFieldType } from "@app/tools/formFill/types";
-import { Icon } from "@app/ui/Icon";
-export const FIELD_TYPE_ICON: Record<FormFieldType, React.ReactNode> = {
- text: <Icon name="type" size={"inherit"} />,
- checkbox: <Icon name="square-check" size={"inherit"} />,
- combobox: <Icon name="circle-chevron-down" size={"inherit"} />,
- listbox: <Icon name="list" size={"inherit"} />,
- radio: <Icon name="radio-checked" size={"inherit"} />,
- button: <Icon name="pen-tool" size={"inherit"} />,
- signature: <Icon name="pen-tool" size={"inherit"} />,
-};
-
-export const FIELD_TYPE_COLOR: Record<FormFieldType, string> = {
- text: "blue",
- checkbox: "green",
- combobox: "violet",
- listbox: "cyan",
- radio: "orange",
- button: "gray",
- signature: "pink",
-};