This commit is contained in:
Robert Long
2021-08-19 17:49:45 -07:00
parent e5c28569c6
commit 9d0162e475
11 changed files with 456 additions and 194 deletions

44
src/Input.jsx Normal file
View File

@@ -0,0 +1,44 @@
import React, { forwardRef } from "react";
import classNames from "classnames";
import styles from "./Input.module.css";
export function FieldRow({ children, rightAlign, className, ...rest }) {
return (
<div
className={classNames(
styles.fieldRow,
{ [styles.rightAlign]: rightAlign },
className
)}
>
{children}
</div>
);
}
export function Field({ children, className, ...rest }) {
return <div className={classNames(styles.field, className)}>{children}</div>;
}
export const InputField = forwardRef(
({ id, label, className, ...rest }, ref) => {
return (
<Field>
<input id={id} {...rest} ref={ref} />
<label for={id}>{label}</label>
</Field>
);
}
);
export const Button = forwardRef(({ className, children, ...rest }, ref) => {
return (
<button
className={classNames(styles.button, className)}
ref={ref}
{...rest}
>
{children}
</button>
);
});