Skip to content

Commit

Permalink
add example component
Browse files Browse the repository at this point in the history
  • Loading branch information
wkim10 committed Oct 10, 2024
1 parent b40eb39 commit 80829d8
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 18 deletions.
21 changes: 3 additions & 18 deletions src/app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,27 +1,12 @@
"use client";

import { addUser } from "./api/user/route.client";
import ExampleButton from "@/components/ExampleButton";

export default function Home() {
return (
<div className="flex items-center justify-center h-screen">
{/* Test Button */}
<button
className="bg-slate-700 text-white p-4 rounded-full"
onClick={async () => {
const response = await addUser({
body: {
user: {
firstName: "Johnny",
email: "[email protected]",
},
},
});
console.log(response);
}}
>
Add User
</button>
{/* Example Button (ExampleButton.tsx in components folder) */}
<ExampleButton buttonText="Add User" />
</div>
);
}
28 changes: 28 additions & 0 deletions src/components/ExampleButton.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { addUser } from "@/app/api/user/route.client";

interface ExampleButtonProps {
buttonText: string;
}

const ExampleButton = ({ buttonText }: ExampleButtonProps) => {
return (
<button
className="bg-slate-700 text-white p-4 rounded-full"
onClick={async () => {
const response = await addUser({
body: {
user: {
firstName: "Johnny",
email: "[email protected]",
},
},
});
console.log(response);
}}
>
{buttonText}
</button>
);
};

export default ExampleButton;

0 comments on commit 80829d8

Please sign in to comment.