Skip to content

Commit 391187c

Browse files
committed
input,button,login
1 parent 70bb4c0 commit 391187c

File tree

4 files changed

+47
-58
lines changed

4 files changed

+47
-58
lines changed

app/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import { Login } from "@/components/Login";
1818

1919
export default function page() {
2020
return (
21-
<div className="container max-w-6xl mx-auto mb-10">
21+
<div className="container max-w-6xl mx-auto mb-96">
2222
<H1>Welcome to RetroUI</H1>
2323

2424
<div className="space-y-8 mt-12">

components/Buttons/Button.tsx

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,26 @@
1-
import React, { ReactNode } from 'react';
1+
import React, { ButtonHTMLAttributes } from "react";
22

3-
interface ButtonProps {
4-
children: ReactNode;
5-
size?: 'sm' | 'md' | 'lg';
3+
interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
4+
size?: "sm" | "md" | "lg";
5+
className?: string;
66
}
77

8-
export function Button({ children, size = 'md' }: ButtonProps) {
8+
export function Button({
9+
children,
10+
size = "md",
11+
className = "",
12+
...props
13+
}: ButtonProps) {
914
const sizeClasses = {
10-
sm: 'px-4 py-1 text-sm',
11-
md: 'px-6 py-2 text-md',
12-
lg: 'px-8 py-3 text-lg',
15+
sm: "px-4 py-1 text-sm",
16+
md: "px-6 py-2 text-base",
17+
lg: "px-8 py-3 text-lg",
1318
};
1419

1520
return (
1621
<button
17-
className={`font-head bg-primary-400 border-2 border-black shadow-md hover:shadow-xs transition-all ${sizeClasses[size]}`}
22+
className={`font-head bg-primary-400 text-primary-foreground border-2 border-black shadow-md hover:shadow-xs transition-all ${sizeClasses[size]} ${className}`}
23+
{...props}
1824
>
1925
{children}
2026
</button>

components/Form/Input.tsx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
1-
import React from "react";
1+
import React, { InputHTMLAttributes } from "react";
22

3-
export function Input({
3+
interface InputProps extends InputHTMLAttributes<HTMLInputElement> {
4+
className?: string;
5+
}
6+
7+
export const Input: React.FC<InputProps> = ({
48
type = "text",
59
placeholder = "Enter text",
610
className = "",
711
...props
8-
}) {
12+
}) => {
913
return (
1014
<input
1115
type={type}
@@ -14,4 +18,4 @@ export function Input({
1418
{...props}
1519
/>
1620
);
17-
}
21+
};

components/Login/Login.tsx

Lines changed: 23 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,38 @@
1-
"use client";
2-
import React, { ReactElement, useState } from "react";
1+
import React from "react";
2+
import { H2 } from "../Typography";
3+
import { Input } from "../Form";
4+
import { Button } from "../Buttons";
5+
import Link from "next/link";
36

4-
export function Login(): ReactElement {
5-
const [customClass, setCustomClass] = useState(false);
6-
7-
const handleClick = () => {
8-
setCustomClass(true);
9-
setTimeout(() => {
10-
setCustomClass(false);
11-
}, 150);
12-
};
7+
export function Login() {
138
return (
14-
<div className="max-w-80 bg-rose-400 border-2 border-black shadow-md ">
15-
<div className="font-head text-3xl text-center px-4 py-2 my-2 ">
16-
Login
9+
<div className="max-w-80 p-4 border-2 border-black shadow-md space-y-3">
10+
<div className="text-center">
11+
<H2>Login</H2>
1712
</div>
18-
<form
19-
onSubmit={(e) => {
20-
e.preventDefault();
21-
}}
22-
className="flex flex-col gap-8"
23-
>
13+
<form className="flex flex-col gap-5 ">
2414
<div className="flex flex-col items-center justify-center">
2515
<label htmlFor="email" className="w-11/12">
2616
Email
2717
</label>
28-
<input
29-
id="email"
30-
type="email"
31-
placeholder="Email"
32-
className="px-4 py-2 w-11/12 font-body border-2 border-black shadow-md transition focus:outline-none focus:shadow-xs "
33-
/>
18+
<Input id="email" type="email" placeholder="email" />
3419
</div>
3520
<div className="flex flex-col items-center justify-center">
36-
<label htmlFor="email" className="w-11/12">
21+
<label htmlFor="password" className="w-11/12">
3722
Password
3823
</label>
39-
<input
40-
type="password"
41-
placeholder="Password"
42-
className={`px-4 py-2 w-11/12 font-body border-2 border-black shadow-md transition focus:outline-none focus:shadow-xs`}
43-
/>
24+
<Input id="password" type="password" placeholder="password" />
4425
</div>
45-
<div className="flex flex-col items-center justify-center py-4">
46-
<button
47-
onClick={handleClick}
48-
className={`px-6 py-2 w-1/2 text-sm font-head bg-primary-400 rounded-full border-2 border-black shadow-md transition-all ${
49-
customClass ? "bg-primary-500 scale-95 shadow-xs" : ""
50-
}`}
51-
>
52-
submit
53-
</button>
54-
<p className="px-4 py-2 ">
55-
Don&apos;t have an account? <a href="/">sign-in</a>
56-
</p>
26+
<div className="flex flex-col items-center justify-center py-4 gap-1">
27+
<Button className="rounded-full active:shadow-none active:scale-95">
28+
Submit
29+
</Button>
30+
<div className="px-4 py-2 space-x-1">
31+
<span>Don&apos;t have an account?</span>
32+
<Link href="/" className="text-primary-700 hover:underline">
33+
sign-in
34+
</Link>
35+
</div>
5736
</div>
5837
</form>
5938
</div>

0 commit comments

Comments
 (0)