mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-27 22:49:56 -05:00
Textifeld component cleanup in AdminX DS
refs. https://github.com/TryGhost/Team/issues/3150
This commit is contained in:
parent
acb0bda5e4
commit
1139ed541b
2 changed files with 6 additions and 6 deletions
|
@ -49,7 +49,7 @@ export const PasswordType: Story = {
|
|||
args: {
|
||||
title: 'Password',
|
||||
type: 'password',
|
||||
placeholder: 'Enter something',
|
||||
placeholder: 'Enter password',
|
||||
hint: 'Here\'s some hint'
|
||||
}
|
||||
};
|
||||
|
|
|
@ -3,12 +3,12 @@ import React from 'react';
|
|||
import Heading from './Heading';
|
||||
import Hint from './Hint';
|
||||
|
||||
type InputFieldType = 'text' | 'number' | 'email' | 'password' | 'checkbox' | 'radio' | 'file' | 'date' | 'time' | 'range' | 'search';
|
||||
type TextFieldType = 'text' | 'number' | 'email' | 'password' | 'file' | 'date' | 'time' | 'search';
|
||||
|
||||
interface ITextField {
|
||||
interface TextFieldProps {
|
||||
inputRef?: React.RefObject<HTMLInputElement>;
|
||||
title?: string;
|
||||
type?: InputFieldType;
|
||||
type?: TextFieldType;
|
||||
value?: string;
|
||||
error?: boolean;
|
||||
placeholder?: string;
|
||||
|
@ -16,7 +16,7 @@ interface ITextField {
|
|||
onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void;
|
||||
}
|
||||
|
||||
const TextField: React.FC<ITextField> = ({
|
||||
const TextField: React.FC<TextFieldProps> = ({
|
||||
type = 'text', inputRef, title, value, error, placeholder, hint, onChange, ...props
|
||||
}) => {
|
||||
return (
|
||||
|
@ -27,7 +27,7 @@ const TextField: React.FC<ITextField> = ({
|
|||
className={`border-b bg-grey-100 px-[10px] py-2 ${error ? `border-red` : `border-grey-300 hover:border-grey-400 focus:border-grey-600`} ${title && `mt-2`}`}
|
||||
defaultValue={value}
|
||||
placeholder={placeholder}
|
||||
type='text'
|
||||
type={type}
|
||||
onChange={onChange}
|
||||
{...props} />
|
||||
{hint && <Hint color={error ? 'red' : ''}>{hint}</Hint>}
|
||||
|
|
Loading…
Add table
Reference in a new issue