CHANGED: Types
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
'use client';
|
||||
|
||||
import React, { forwardRef, useState } from 'react';
|
||||
import { bool, string } from 'prop-types';
|
||||
import { type TextFieldInterface } from './text-field.types';
|
||||
import { bool, oneOf, string } from 'prop-types';
|
||||
import React, { FocusEvent, forwardRef, useState } from 'react';
|
||||
import { TextFieldInterface } from './text-field.types';
|
||||
|
||||
export const TextField = forwardRef<HTMLInputElement, TextFieldInterface>(
|
||||
(
|
||||
@@ -15,11 +15,9 @@ export const TextField = forwardRef<HTMLInputElement, TextFieldInterface>(
|
||||
},
|
||||
ref,
|
||||
) => {
|
||||
const [raised, setRaised] = useState<boolean>(
|
||||
props.placeholder ?? false,
|
||||
);
|
||||
const [raised, setRaised] = useState<boolean>(!props.placeholder);
|
||||
|
||||
const callback = (e: any): void => {
|
||||
const callback = (e: FocusEvent<HTMLInputElement>): void => {
|
||||
if (
|
||||
e.type === 'blur' &&
|
||||
e.target.value.length === 0 &&
|
||||
@@ -97,7 +95,7 @@ TextField.propTypes = {
|
||||
withBeforeIcon: bool,
|
||||
withAfterIcon: bool,
|
||||
className: string,
|
||||
variant: string,
|
||||
variant: oneOf(['filled', 'outlined']),
|
||||
placeholder: string,
|
||||
supportingText: string,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user