This commit is contained in:
Michael Freno
2025-12-23 10:23:43 -05:00
parent ee1de16c9e
commit 236555e41e
12 changed files with 20 additions and 210 deletions

View File

@@ -7,9 +7,6 @@ export interface ButtonProps extends JSX.ButtonHTMLAttributes<HTMLButtonElement>
fullWidth?: boolean;
}
/**
* Reusable button component with variants and loading state
*/
export default function Button(props: ButtonProps) {
const [local, others] = splitProps(props, [
"variant",
@@ -18,13 +15,14 @@ export default function Button(props: ButtonProps) {
"fullWidth",
"class",
"children",
"disabled",
"disabled"
]);
const variant = () => local.variant || "primary";
const size = () => local.size || "md";
const baseClasses = "flex justify-center items-center rounded font-semibold transition-all duration-300 ease-out disabled:opacity-50 disabled:cursor-not-allowed";
const baseClasses =
"flex justify-center items-center rounded font-semibold transition-all duration-300 ease-out disabled:opacity-50 disabled:cursor-not-allowed";
const variantClasses = () => {
switch (variant()) {
@@ -64,7 +62,7 @@ export default function Button(props: ButtonProps) {
>
<Show when={local.loading} fallback={local.children}>
<svg
class="animate-spin h-5 w-5 mr-2"
class="mr-2 h-5 w-5 animate-spin"
xmlns="http://www.w3.org/2000/svg"
fill="none"
viewBox="0 0 24 24"

View File

@@ -6,12 +6,13 @@ export interface InputProps extends JSX.InputHTMLAttributes<HTMLInputElement> {
helperText?: string;
}
/**
* Reusable input component with label and error handling
* Styled to match Next.js migration source (underlined input style)
*/
export default function Input(props: InputProps) {
const [local, others] = splitProps(props, ["label", "error", "helperText", "class"]);
const [local, others] = splitProps(props, [
"label",
"error",
"helperText",
"class"
]);
return (
<div class="input-group">
@@ -23,22 +24,18 @@ export default function Input(props: InputProps) {
aria-describedby={local.error ? `${others.id}-error` : undefined}
/>
<span class="bar"></span>
{local.label && (
<label class="underlinedInputLabel">{local.label}</label>
)}
{local.label && <label class="underlinedInputLabel">{local.label}</label>}
{local.error && (
<span
id={`${others.id}-error`}
class="text-xs text-red-500 mt-1 block"
class="mt-1 block text-xs text-red-500"
role="alert"
>
{local.error}
</span>
)}
{local.helperText && !local.error && (
<span class="text-xs text-gray-500 mt-1 block">
{local.helperText}
</span>
<span class="mt-1 block text-xs text-gray-500">{local.helperText}</span>
)}
</div>
);