Skip to content

Commit 7cc4a59

Browse files
committed
feat: update form comps. styles, add error message
1 parent 41cbff7 commit 7cc4a59

6 files changed

Lines changed: 19 additions & 12 deletions

File tree

src/components/Button/Button.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import type { ButtonHTMLAttributes, FC, PropsWithChildren } from 'react'
22

33
export const Button: FC<PropsWithChildren<ButtonHTMLAttributes<HTMLButtonElement>>> = ({ children, ...props }) => (
4-
<button className="bg-blue-500 text-white px-4 py-2 rounded-md" type="submit" {...props}>
4+
<button className="bg-blue-500 text-white px-4 py-2 rounded-sm" type="submit" {...props}>
55
{children}
66
</button>
77
)
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { FC } from 'react'
2+
3+
type Props = {
4+
message: string
5+
}
6+
7+
export const ErrorMessage: FC<Props> = ({ message }) => <p className="text-red-500 text-sm">{message}</p>
Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
1-
import type { FC, PropsWithChildren, HTMLAttributes } from 'react'
1+
import type { FC, PropsWithChildren } from 'react'
2+
import { ErrorMessage } from '../ErrorMessage/ErrorMessage'
23

3-
export const FieldWrapper: FC<PropsWithChildren<HTMLAttributes<HTMLDivElement>>> = ({ children, ...props }) => (
4+
type Props = {
5+
errorMessage?: string
6+
}
7+
8+
export const FieldWrapper: FC<PropsWithChildren<Props>> = ({ children, errorMessage, ...props }) => (
49
<div className="flex flex-col gap-2" {...props}>
510
{children}
11+
{errorMessage && <ErrorMessage message={errorMessage} />}
612
</div>
713
)

src/components/Form/Form.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import clsx from 'clsx'
2-
import type { FC, HTMLAttributes, PropsWithChildren } from 'react'
2+
import type { FC, PropsWithChildren, FormHTMLAttributes } from 'react'
33

4-
export const Form: FC<PropsWithChildren<HTMLAttributes<HTMLFormElement>>> = ({ children, className, ...props }) => (
4+
export const Form: FC<PropsWithChildren<FormHTMLAttributes<HTMLFormElement>>> = ({ children, className, ...props }) => (
55
<form className={clsx('flex flex-col gap-4', className)} {...props}>
66
{children}
77
</form>

src/components/Input/Input.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ import clsx from 'clsx'
22
import type { FC, InputHTMLAttributes } from 'react'
33

44
export const Input: FC<InputHTMLAttributes<HTMLInputElement>> = ({ className, ...props }) => (
5-
<input className={clsx('border border-gray-300 rounded-md p-2', className)} {...props} />
5+
<input className={clsx('border border-gray-700 bg-gray-800 rounded-sm p-1', className)} {...props} />
66
)

src/components/Textarea/Textarea.tsx

Lines changed: 0 additions & 6 deletions
This file was deleted.

0 commit comments

Comments
 (0)