feat: login example
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
export * from './forgot-step';
|
||||
export * from './otp-form';
|
||||
export * from './input-form';
|
||||
export * from './input-field';
|
||||
export * from './pagination';
|
||||
export * from './modal/modal';
|
||||
export * from './stepper';
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
export * from './input-field';
|
||||
+3
-3
@@ -1,9 +1,9 @@
|
||||
import { render, screen } from '@testing-library/react';
|
||||
import InputForm from './input-form';
|
||||
import { InputField } from './input-field';
|
||||
|
||||
describe('InputForm Component', () => {
|
||||
it('renders correctly with disabled prop', () => {
|
||||
render(<InputForm label="Test Label" disabled={true} />);
|
||||
render(<InputField label="Test Label" disabled={true} />);
|
||||
|
||||
const input = screen.getByLabelText('Test Label');
|
||||
expect(input).toBeDisabled();
|
||||
@@ -11,7 +11,7 @@ describe('InputForm Component', () => {
|
||||
});
|
||||
|
||||
it('renders correctly without disabled prop', () => {
|
||||
render(<InputForm label="Test Label" disabled={false} />);
|
||||
render(<InputField label="Test Label" disabled={false} />);
|
||||
|
||||
const input = screen.getByLabelText('Test Label');
|
||||
expect(input).not.toBeDisabled();
|
||||
+3
-3
@@ -1,9 +1,9 @@
|
||||
import type { Meta, StoryObj } from '@storybook/react';
|
||||
import { InputForm } from './input-form';
|
||||
import { InputField } from './input-field';
|
||||
|
||||
const meta = {
|
||||
title: 'Molecules/Input Form',
|
||||
component: InputForm,
|
||||
component: InputField,
|
||||
parameters: {
|
||||
layout: 'centered',
|
||||
docs: {
|
||||
@@ -27,7 +27,7 @@ Cek dan inspect element pada story With HtmlFor untuk melihat hasilnya.
|
||||
},
|
||||
},
|
||||
tags: ['autodocs'],
|
||||
} satisfies Meta<typeof InputForm>;
|
||||
} satisfies Meta<typeof InputField>;
|
||||
|
||||
export default meta;
|
||||
type Story = StoryObj<typeof meta>;
|
||||
+4
-8
@@ -7,10 +7,9 @@ import {
|
||||
import { Input } from '../../atoms';
|
||||
import { cn } from '@imphnen-frontend-service/utils';
|
||||
|
||||
type TInputType = 'text' | 'email' | 'password' | 'file';
|
||||
type TInputSize = 'sm' | 'md' | 'lg';
|
||||
|
||||
type TInputFormProps = Omit<
|
||||
export type TInputType = 'text' | 'email' | 'password' | 'file';
|
||||
export type TInputSize = 'sm' | 'md' | 'lg';
|
||||
export type TInputFieldProps = Omit<
|
||||
DetailedHTMLProps<InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>,
|
||||
'size' | 'type'
|
||||
> & {
|
||||
@@ -19,7 +18,6 @@ type TInputFormProps = Omit<
|
||||
size?: TInputSize;
|
||||
error?: string;
|
||||
disabled?: boolean;
|
||||
|
||||
helperText?: string;
|
||||
htmlFor?: string;
|
||||
};
|
||||
@@ -39,7 +37,7 @@ const sizeClasses: Record<TInputSize, { label: string; helperText: string }> = {
|
||||
},
|
||||
};
|
||||
|
||||
export const InputForm: FC<TInputFormProps> = ({
|
||||
export const InputField: FC<TInputFieldProps> = ({
|
||||
label,
|
||||
placeholder,
|
||||
type = 'text',
|
||||
@@ -88,5 +86,3 @@ export const InputForm: FC<TInputFormProps> = ({
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default InputForm;
|
||||
@@ -1 +0,0 @@
|
||||
export * from './input-form';
|
||||
Reference in New Issue
Block a user