From f1b697b47ad075cef1f78457896b62e2833fd2ab Mon Sep 17 00:00:00 2001 From: Aleix Soler Date: Wed, 16 Jul 2025 18:49:21 +0200 Subject: [PATCH] chore: standardized form input components --- .../components/FilterSection.tsx | 9 ++- .../SettingsUI.tsx/CustomStatusItem.tsx | 55 ++++++------- components/atoms/Input.tsx | 78 +++++++++++++++++++ components/atoms/SearchFilter.tsx | 16 +--- styles/components/custom-status-item.css | 25 +++--- 5 files changed, 125 insertions(+), 58 deletions(-) create mode 100644 components/atoms/Input.tsx diff --git a/components/GroupedStatusView/components/FilterSection.tsx b/components/GroupedStatusView/components/FilterSection.tsx index 5ca2523..d350fbd 100644 --- a/components/GroupedStatusView/components/FilterSection.tsx +++ b/components/GroupedStatusView/components/FilterSection.tsx @@ -1,5 +1,6 @@ import React from "react"; import { SearchFilter } from "@/components/atoms/SearchFilter"; +import { Input } from "@/components/atoms/Input"; interface FilterSectionProps { searchFilter: string; @@ -23,12 +24,12 @@ export const FilterSection = ({ onFilterChange={onSearchFilterChange} />
- onNoteNameFilterChange(e.target.value)} />
diff --git a/components/SettingsUI.tsx/CustomStatusItem.tsx b/components/SettingsUI.tsx/CustomStatusItem.tsx index d27024a..7e9aefb 100644 --- a/components/SettingsUI.tsx/CustomStatusItem.tsx +++ b/components/SettingsUI.tsx/CustomStatusItem.tsx @@ -1,6 +1,7 @@ import { NoteStatus } from "@/types/noteStatus"; import { PluginSettings } from "@/types/pluginSettings"; import React from "react"; +import { Input } from "@/components/atoms/Input"; export type Props = { status: NoteStatus; @@ -26,56 +27,48 @@ export const CustomStatusItem: React.FC = ({ className="custom-status-preview" style={{ borderLeftColor: status.color || "var(--text-muted)" }} > - - onCustomStatusChange( - index, - "icon", - e.target.value || "❓", - ) + onChange={(value) => + onCustomStatusChange(index, "icon", value || "❓") } + placeholder="🔥" + className="custom-status-icon-input" />
- + onChange={(value) => onCustomStatusChange( index, "name", - e.target.value || "unnamed", + value || "unnamed", ) } + placeholder="Status name" + className="custom-status-name-input" style={{ color: status.color || "var(--text-normal)" }} /> - - onCustomStatusChange( - index, - "description", - e.target.value, - ) + onChange={(value) => + onCustomStatusChange(index, "description", value) } + placeholder="Description (optional)" + className="custom-status-description-input" />
- - onCustomStatusChange(index, "color", e.target.value) + onChange={(value) => + onCustomStatusChange(index, "color", value) } + className="custom-status-color-input" />