Skip to content

Commit 129ca71

Browse files
authored
Merge pull request #7 from ariflogs/dev
Main <- dev (Login component)
2 parents 1a0e772 + 48a6d6b commit 129ca71

File tree

6 files changed

+1730
-2021
lines changed

6 files changed

+1730
-2021
lines changed

app/page.tsx

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,24 @@
11
import React from "react";
2-
import { Button, H1, H2, H3, H4, H5, H6, Input, Textarea, Accordion, BasicCard, ProductCard, Avatar } from "@/components";
2+
import {
3+
Button,
4+
H1,
5+
H2,
6+
H3,
7+
H4,
8+
H5,
9+
H6,
10+
Input,
11+
Textarea,
12+
Accordion,
13+
BasicCard,
14+
ProductCard,
15+
Avatar,
16+
} from "@/components";
17+
import { Login } from "@/components/Login";
318

419
export default function page() {
520
return (
6-
<div className="container max-w-6xl mx-auto">
21+
<div className="container max-w-6xl mx-auto mb-96">
722
<H1>Welcome to RetroUI</H1>
823

924
<div className="space-y-8 mt-12">
@@ -46,6 +61,11 @@ export default function page() {
4661
<div className="h-4"></div>
4762
<ProductCard />
4863
</div>
64+
65+
<div>
66+
<H3>Login</H3>
67+
<Login />
68+
</div>
4969
</div>
5070
</div>
5171
);

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: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
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";
6+
7+
export function Login() {
8+
return (
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>
12+
</div>
13+
<form className="flex flex-col gap-5 ">
14+
<div className="flex flex-col items-center justify-center">
15+
<label htmlFor="email" className="w-11/12">
16+
Email
17+
</label>
18+
<Input id="email" type="email" placeholder="email" />
19+
</div>
20+
<div className="flex flex-col items-center justify-center">
21+
<label htmlFor="password" className="w-11/12">
22+
Password
23+
</label>
24+
<Input id="password" type="password" placeholder="password" />
25+
</div>
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>
36+
</div>
37+
</form>
38+
</div>
39+
);
40+
}

components/Login/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from "./Login";

0 commit comments

Comments
 (0)