refactor: extract Button to component, reformat all files with Prettier

This commit is contained in:
Sam 2022-11-18 14:11:52 +01:00
parent 1080d8a0cd
commit bfdaafeb0a
15 changed files with 504 additions and 335 deletions

View file

@ -1,19 +1,24 @@
import { ChangeEventHandler } from "react";
export type Props = {
defaultValue?: string;
value?: string;
onChange?: ChangeEventHandler<HTMLInputElement>;
contrastBackground?: boolean;
defaultValue?: string;
value?: string;
onChange?: ChangeEventHandler<HTMLInputElement>;
};
export default function TextInput(props: Props) {
return (
<input
type="text"
className="p-1 lg:p-2 rounded-md bg-white border-slate-300 text-black dark:bg-slate-800 dark:border-slate-900 dark:text-white"
defaultValue={props.defaultValue}
value={props.value}
onChange={props.onChange}
/>
);
const bg = props.contrastBackground
? "bg-slate-50 dark:bg-slate-700"
: "bg-white dark:bg-slate-800";
return (
<input
type="text"
className={`p-1 lg:p-2 rounded-md ${bg} border-slate-300 text-black dark:border-slate-900 dark:text-white`}
defaultValue={props.defaultValue}
value={props.value}
onChange={props.onChange}
/>
);
}