refactor(ui): replace inline INPUT_CLS/LABEL_CLS/BTN_DANGER constants and action link classes with CSS component classes
Remove duplicated Tailwind class string constants from 15 component files. Use app-input, app-select, app-label, app-action-danger-btn, and app-action-delete CSS component classes from globals.css instead. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -5,8 +5,6 @@ import { FieldType } from "@capakraken/shared";
|
||||
import type { BlueprintFieldDefinition } from "@capakraken/shared";
|
||||
import { trpc } from "~/lib/trpc/client.js";
|
||||
|
||||
const INPUT_CLS = "app-input";
|
||||
|
||||
interface Props {
|
||||
selectedIds: string[];
|
||||
fieldDefs: BlueprintFieldDefinition[];
|
||||
@@ -136,7 +134,7 @@ function FieldInput({ field, value, onChange }: { field: BlueprintFieldDefinitio
|
||||
|
||||
if (field.type === FieldType.BOOLEAN) {
|
||||
return (
|
||||
<select value={str} onChange={(e) => onChange(e.target.value === "true")} className={INPUT_CLS}>
|
||||
<select value={str} onChange={(e) => onChange(e.target.value === "true")} className="app-input">
|
||||
<option value="">— select —</option>
|
||||
<option value="true">Yes</option>
|
||||
<option value="false">No</option>
|
||||
@@ -146,7 +144,7 @@ function FieldInput({ field, value, onChange }: { field: BlueprintFieldDefinitio
|
||||
|
||||
if (field.type === FieldType.SELECT && field.options) {
|
||||
return (
|
||||
<select value={str} onChange={(e) => onChange(e.target.value)} className={INPUT_CLS}>
|
||||
<select value={str} onChange={(e) => onChange(e.target.value)} className="app-input">
|
||||
<option value="">— select —</option>
|
||||
{field.options.map((o) => <option key={o.value} value={o.value}>{o.label || o.value}</option>)}
|
||||
</select>
|
||||
@@ -160,13 +158,13 @@ function FieldInput({ field, value, onChange }: { field: BlueprintFieldDefinitio
|
||||
value={str}
|
||||
onChange={(e) => onChange(e.target.value ? Number(e.target.value) : "")}
|
||||
placeholder={field.placeholder}
|
||||
className={INPUT_CLS}
|
||||
className="app-input"
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
if (field.type === FieldType.DATE) {
|
||||
return <input type="date" value={str} onChange={(e) => onChange(e.target.value)} className={INPUT_CLS} />;
|
||||
return <input type="date" value={str} onChange={(e) => onChange(e.target.value)} className="app-input" />;
|
||||
}
|
||||
|
||||
if (field.type === FieldType.TEXTAREA) {
|
||||
@@ -175,7 +173,7 @@ function FieldInput({ field, value, onChange }: { field: BlueprintFieldDefinitio
|
||||
value={str}
|
||||
onChange={(e) => onChange(e.target.value)}
|
||||
placeholder={field.placeholder}
|
||||
className={`${INPUT_CLS} w-full resize-none`}
|
||||
className="app-input resize-none"
|
||||
rows={3}
|
||||
/>
|
||||
);
|
||||
@@ -187,7 +185,7 @@ function FieldInput({ field, value, onChange }: { field: BlueprintFieldDefinitio
|
||||
value={str}
|
||||
onChange={(e) => onChange(e.target.value)}
|
||||
placeholder={field.placeholder}
|
||||
className={`${INPUT_CLS} w-full`}
|
||||
className="app-input"
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user