Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP/Input and Textarea #166

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion pkgs/frontend/.eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@ module.exports = {
{ name: "NavLink", linkAttribute: "to" },
],
"import/resolver": {
typescript: {},
typescript: {
project: "pkgs/frontend/tsconfig.json",
},
},
},
},
Expand Down
16 changes: 16 additions & 0 deletions pkgs/frontend/app/components/Input.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { ChangeEvent } from "react";

interface InputProps {
value: string | number;
onChange: (e: ChangeEvent<HTMLInputElement>) => void;
}

export default function Input({ value, onChange }: InputProps) {
return (
<input
className="input input-bordered w-full"
value={value}
onChange={onChange}
/>
);
}
16 changes: 16 additions & 0 deletions pkgs/frontend/app/components/Textarea.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { ChangeEvent } from "react";

interface TextareaProps {
value: string | number;
onChange: (e: ChangeEvent<HTMLTextAreaElement>) => void;
}

export default function Textarea({ value, onChange }: TextareaProps) {
return (
<textarea
className="textarea textarea-bordered w-full"
value={value}
onChange={onChange}
/>
);
}
14 changes: 14 additions & 0 deletions pkgs/frontend/app/routes/_index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import type { MetaFunction } from "@remix-run/node";
import Input from "~/components/Input";
import Textarea from "~/components/Textarea";
import { useState } from "react";

export const meta: MetaFunction = () => {
return [
Expand All @@ -8,11 +11,22 @@ export const meta: MetaFunction = () => {
};

export default function Index() {
const [inputValue, setInputValue] = useState("foo");
const [textareaValue, setTextareaValue] = useState("bar");

return (
<>
<button className="btn rounded">
<span className="loading loading-spinner" />
</button>
<Input
value={inputValue}
onChange={(e) => setInputValue(e.target.value)}
/>
<Textarea
value={textareaValue}
onChange={(e) => setTextareaValue(e.target.value)}
/>
</>
);
}
Loading