project-nomad/admin/inertia/components/inputs/Input.tsx
Chris Sherwood e8d775dfe4 feat(UI): add Night Ops dark mode with theme toggle
Add a warm charcoal dark mode ("Night Ops") using CSS variable swapping
under [data-theme="dark"]. All 23 desert palette variables are overridden
with dark-mode counterparts, and ~313 generic Tailwind classes (bg-white,
text-gray-*, border-gray-*) are replaced with semantic tokens.

Infrastructure:
- CSS variable overrides in app.css for both themes
- ThemeProvider + useTheme hook (localStorage + KV store sync)
- ThemeToggle component (moon/sun icons, "Night Ops"/"Day Ops" labels)
- FOUC prevention script in inertia_layout.edge
- Toggle placed in StyledSidebar and Footer for access on every page

Color replacements across 50 files:
- bg-white → bg-surface-primary
- bg-gray-50/100 → bg-surface-secondary
- text-gray-900/800 → text-text-primary
- text-gray-600/500 → text-text-secondary/text-text-muted
- border-gray-200/300 → border-border-subtle/border-border-default
- text-desert-white → text-white (fixes invisible text on colored bg)
- Button hover/active states use dedicated btn-green-hover/active vars

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-16 09:17:05 -07:00

65 lines
1.8 KiB
TypeScript

import classNames from "classnames";
import { InputHTMLAttributes } from "react";
export interface InputProps extends InputHTMLAttributes<HTMLInputElement> {
name: string;
label: string;
helpText?: string;
className?: string;
labelClassName?: string;
inputClassName?: string;
containerClassName?: string;
leftIcon?: React.ReactNode;
error?: boolean;
required?: boolean;
}
const Input: React.FC<InputProps> = ({
className,
label,
name,
helpText,
labelClassName,
inputClassName,
containerClassName,
leftIcon,
error,
required,
...props
}) => {
return (
<div className={classNames(className)}>
<label
htmlFor={name}
className={classNames("block text-base/6 font-medium text-text-primary", labelClassName)}
>
{label}{required ? "*" : ""}
</label>
{helpText && <p className="mt-1 text-sm text-text-muted">{helpText}</p>}
<div className={classNames("mt-1.5", containerClassName)}>
<div className="relative">
{leftIcon && (
<div className="absolute left-3 top-1/2 transform -translate-y-1/2">
{leftIcon}
</div>
)}
<input
id={name}
name={name}
placeholder={props.placeholder || label}
className={classNames(
inputClassName,
"block w-full rounded-md bg-surface-primary px-3 py-2 text-base text-text-primary border border-border-default placeholder:text-text-muted focus:outline focus:outline-2 focus:-outline-offset-2 focus:outline-primary sm:text-sm/6",
leftIcon ? "pl-10" : "pl-3",
error ? "!border-red-500 focus:outline-red-500 !bg-red-100" : ""
)}
{...props}
/>
</div>
</div>
</div>
);
};
export default Input;