Skip to content

Commit

Permalink
update user registrationpage
Browse files Browse the repository at this point in the history
  • Loading branch information
susumutomita committed May 22, 2024
1 parent 34ce511 commit 160b844
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 35 deletions.
38 changes: 23 additions & 15 deletions src/app/dashboard/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,28 +38,30 @@ const Dashboard = () => {
return (
<div>
<Navbar />
<div className="container">
<div className="container mx-auto p-4">
<div className="flex items-center justify-between mb-8">
<h1 className="text-3xl font-bold">ダッシュボード</h1>
<button className="btn-primary">新しいメモを作成</button>
<h1 className="text-3xl font-bold">Dashboard</h1>
<button className="inline-block rounded-lg bg-indigo-500 px-8 py-3 text-center text-sm font-semibold text-white outline-none ring-indigo-300 transition duration-100 hover:bg-indigo-600 focus-visible:ring active:bg-indigo-700 md:text-base">
Create New Post
</button>
</div>
<div className="flex flex-col md:flex-row gap-4">
<div className="w-full md:w-3/4">
<div className="card">
<h2 className="card-header">更新されたメモ</h2>
<div className="bg-white p-4 rounded-lg shadow-md">
<h2 className="text-lg font-bold">Recent Posts</h2>
<ul>
{posts.map(post => (
<li
key={post.id}
className="border-b border-gray-700 last:border-b-0 py-2 flex justify-between items-center"
className="border-b last:border-b-0 py-2 flex justify-between items-center"
>
<div>
<h3 className="font-bold">{post.title}</h3>
<p className="card-body">
<p className="text-sm text-gray-500">
{post.category} - {post.author.name}
</p>
</div>
<div className="text-sm text-gray-400">
<div className="text-sm text-gray-500">
{new Date(post.createdAt).toLocaleString()}
</div>
</li>
Expand All @@ -68,18 +70,24 @@ const Dashboard = () => {
</div>
</div>
<div className="w-full md:w-1/4">
<div className="card">
<h2 className="card-header">最近見たメモ</h2>
<p className="card-body">現在見ているメモはありません。</p>
<div className="bg-white p-4 rounded-lg shadow-md">
<h2 className="text-lg font-bold">Recently Viewed Posts</h2>
<p>No posts viewed recently.</p>
</div>
</div>
</div>
<div className="text-center mt-8">
<Link href="/users" className="btn-secondary mr-4">
ユーザーを作成
<Link
href="/users"
className="inline-block rounded-lg bg-gray-200 px-8 py-3 text-center text-sm font-semibold text-gray-500 outline-none ring-indigo-300 transition duration-100 hover:bg-gray-300 focus-visible:ring active:text-gray-700 md:text-base"
>
Create User
</Link>
<Link href="/api-docs" className="btn-secondary">
APIドキュメント
<Link
href="/api-docs"
className="inline-block rounded-lg bg-gray-200 px-8 py-3 text-center text-sm font-semibold text-gray-500 outline-none ring-indigo-300 transition duration-100 hover:bg-gray-300 focus-visible:ring active:text-gray-700 md:text-base"
>
API Docs
</Link>
</div>
</div>
Expand Down
67 changes: 47 additions & 20 deletions src/app/users/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import axios from 'axios';
import { useState } from 'react';
import type { NextPage } from 'next';
import Navbar from '../components/Navbar';

const CreateUser: NextPage = () => {
const [email, setEmail] = useState('');
Expand All @@ -25,27 +26,53 @@ const CreateUser: NextPage = () => {
};

return (
<form onSubmit={handleSubmit}>
<div>
<label htmlFor="email">Email:</label>
<input
type="email"
id="email"
value={email}
onChange={e => setEmail(e.target.value)}
/>
<div>
<Navbar />
<div className="container mx-auto p-4">
<h1 className="text-3xl font-bold mb-8">Create User</h1>
<form
onSubmit={handleSubmit}
className="bg-white p-4 rounded-lg shadow-md"
>
<div className="mb-4">
<label
htmlFor="email"
className="block text-sm font-medium text-gray-700"
>
Email:
</label>
<input
type="email"
id="email"
value={email}
onChange={e => setEmail(e.target.value)}
className="mt-1 p-2 block w-full border rounded-md bg-black text-white"
/>
</div>
<div className="mb-4">
<label
htmlFor="name"
className="block text-sm font-medium text-gray-700"
>
Name:
</label>
<input
type="text"
id="name"
value={name}
onChange={e => setName(e.target.value)}
className="mt-1 p-2 block w-full border rounded-md bg-black text-white"
/>
</div>
<button
type="submit"
className="inline-block rounded-lg bg-indigo-500 px-8 py-3 text-center text-sm font-semibold text-white outline-none ring-indigo-300 transition duration-100 hover:bg-indigo-600 focus-visible:ring active:bg-indigo-700 md:text-base"
>
Submit
</button>
</form>
</div>
<div>
<label htmlFor="name">Name:</label>
<input
type="text"
id="name"
value={name}
onChange={e => setName(e.target.value)}
/>
</div>
<button type="submit">Submit</button>
</form>
</div>
);
};

Expand Down

0 comments on commit 160b844

Please sign in to comment.