Skip to content

Commit af6058e

Browse files
committed
login form component
1 parent fcc3deb commit af6058e

File tree

6 files changed

+93
-6
lines changed

6 files changed

+93
-6
lines changed

src/components/Button/Button.stories.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export const Outline: Story = {
2929

3030
export const Ghost: Story = {
3131
args: {
32-
title: 'Click me',
32+
children: 'Click me',
3333
variant: 'ghost',
3434
},
3535
}

src/components/Button/Button.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,7 @@ export const Button = forwardRef<HTMLButtonElement, ButtonProps>(({
6666
...props
6767
}, ref) => {
6868
return (
69-
<button ref={ref} className={cn(buttonStyles({variant, size, colorScheme}))} {...props}>
70-
{props.title}
71-
</button>
69+
<button ref={ref} className={cn(buttonStyles({variant, size, colorScheme}))} {...props}/>
7270
)
7371
})
7472

src/components/Input/Input.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export const Input = forwardRef<HTMLInputElement, InputProps>(({
2727
ref={ref}
2828
type="text"
2929
autoComplete="off"
30-
className={cn(inputStyles(), className)}
30+
className={cn(inputStyles({className}))}
3131
{...props}
3232
/>
3333
});

src/components/Layout/Box/Box.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
import { ComponentPropsWithRef, forwardRef } from "react";
2+
import { cn } from "../../../utils";
23

34
export type BoxProps = ComponentPropsWithRef<'div'>;
45

56
export const Box =forwardRef<HTMLDivElement, BoxProps>(({
7+
className,
68
...props
79
}, ref) => {
8-
return <div ref={ref} {...props} />
10+
return <div ref={ref} className={cn(className)} {...props} />
911
});
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import { Meta, StoryObj } from '@storybook/react';
2+
import LoginForm from './LoginForm';
3+
4+
const meta: Meta<typeof LoginForm> = {
5+
title: 'Components/LoginForm',
6+
component: LoginForm,
7+
parameters: {
8+
layout: 'centered',
9+
},
10+
tags: ['autodocs'],
11+
};
12+
13+
export default meta;
14+
15+
type Story = StoryObj<typeof LoginForm>;
16+
17+
export const Login: Story = {}
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
import React from 'react'
2+
import { Box } from '../Layout/Box/Box'
3+
import Stack from '../Layout/Stack/Stack'
4+
import { Text } from '../Text/Text'
5+
import { Input } from '../Input/Input'
6+
import Button from '../Button/Button'
7+
8+
const LoginForm = () => {
9+
return (
10+
<Box className='px-8 py-12 border border-gray-300 rounded-xl'>
11+
<Stack>
12+
<Text
13+
as='h2'
14+
weight={'bold'}
15+
align={'center'}
16+
size={'3xl'}
17+
className='mb-2'
18+
>
19+
Login
20+
</Text>
21+
22+
<Text
23+
as='span'
24+
emphasis={'low'}
25+
size={'sm'}
26+
align={'center'}
27+
className='mb-8'
28+
>
29+
Please enter your credentials to login
30+
</Text>
31+
32+
<Text as='label' htmlFor="username" size={'sm'} weight={'medium'} className='mb-1.5'>
33+
Username
34+
</Text>
35+
<Input
36+
type='text'
37+
id='username'
38+
placeholder='Username'
39+
className='mb-4'
40+
/>
41+
42+
<Text
43+
as='label'
44+
htmlFor="password"
45+
size={'sm'}
46+
weight={'medium'}
47+
className='mb-1.5'
48+
>
49+
Password
50+
</Text>
51+
<Input
52+
type='password'
53+
id='password'
54+
placeholder='Password'
55+
className='mb-4'
56+
/>
57+
58+
<Button
59+
type='submit'
60+
variant={'solid'}
61+
className='mb-10'
62+
>
63+
Login
64+
</Button>
65+
</Stack>
66+
</Box>
67+
)
68+
}
69+
70+
export default LoginForm

0 commit comments

Comments
 (0)