From 1139ed541b87aad766a09d9ba748f05d0aa82dd2 Mon Sep 17 00:00:00 2001 From: Peter Zimon Date: Tue, 23 May 2023 08:42:20 +0200 Subject: [PATCH] Textifeld component cleanup in AdminX DS refs. https://github.com/TryGhost/Team/issues/3150 --- .../src/admin-x-ds/global/TextField.stories.tsx | 2 +- .../src/admin-x-ds/global/TextField.tsx | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/ghost/admin-x-settings/src/admin-x-ds/global/TextField.stories.tsx b/ghost/admin-x-settings/src/admin-x-ds/global/TextField.stories.tsx index 0083852a8d..af55cf2289 100644 --- a/ghost/admin-x-settings/src/admin-x-ds/global/TextField.stories.tsx +++ b/ghost/admin-x-settings/src/admin-x-ds/global/TextField.stories.tsx @@ -49,7 +49,7 @@ export const PasswordType: Story = { args: { title: 'Password', type: 'password', - placeholder: 'Enter something', + placeholder: 'Enter password', hint: 'Here\'s some hint' } }; diff --git a/ghost/admin-x-settings/src/admin-x-ds/global/TextField.tsx b/ghost/admin-x-settings/src/admin-x-ds/global/TextField.tsx index 57b14e2b8a..75f3523f27 100644 --- a/ghost/admin-x-settings/src/admin-x-ds/global/TextField.tsx +++ b/ghost/admin-x-settings/src/admin-x-ds/global/TextField.tsx @@ -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; title?: string; - type?: InputFieldType; + type?: TextFieldType; value?: string; error?: boolean; placeholder?: string; @@ -16,7 +16,7 @@ interface ITextField { onChange?: (event: React.ChangeEvent) => void; } -const TextField: React.FC = ({ +const TextField: React.FC = ({ type = 'text', inputRef, title, value, error, placeholder, hint, onChange, ...props }) => { return ( @@ -27,7 +27,7 @@ const TextField: React.FC = ({ 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}}