From e7d02da096f498b5d34ccf6d6bc04746af3594d8 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Mon, 9 May 2022 12:05:32 -0500 Subject: [PATCH] Delete legacy ShowablePassword component (new component adapts to type='password') --- app/soapbox/components/showable_password.tsx | 67 -------------------- 1 file changed, 67 deletions(-) delete mode 100644 app/soapbox/components/showable_password.tsx diff --git a/app/soapbox/components/showable_password.tsx b/app/soapbox/components/showable_password.tsx deleted file mode 100644 index 7d7858fdc..000000000 --- a/app/soapbox/components/showable_password.tsx +++ /dev/null @@ -1,67 +0,0 @@ -import classNames from 'classnames'; -import React, { useState } from 'react'; -import { defineMessages, useIntl } from 'react-intl'; - -import IconButton from 'soapbox/components/icon_button'; -import { InputContainer, LabelInputContainer } from 'soapbox/features/forms'; - -const messages = defineMessages({ - showPassword: { id: 'forms.show_password', defaultMessage: 'Show password' }, - hidePassword: { id: 'forms.hide_password', defaultMessage: 'Hide password' }, -}); - -interface IShowablePassword { - label?: React.ReactNode, - className?: string, - hint?: React.ReactNode, - placeholder?: string, - error?: boolean, - onToggleVisibility?: () => void, - autoComplete?: string, - autoCorrect?: string, - autoCapitalize?: string, - name?: string, - required?: boolean, - onChange?: React.ChangeEventHandler, - onBlur?: React.ChangeEventHandler, - value?: string, -} - -const ShowablePassword: React.FC = (props) => { - const intl = useIntl(); - const [revealed, setRevealed] = useState(false); - - const { hint, error, label, className, ...rest } = props; - - const toggleReveal = () => { - if (props.onToggleVisibility) { - props.onToggleVisibility(); - } else { - setRevealed(!revealed); - } - }; - - const revealButton = ( - - ); - - return ( - - {label ? ( - - - {revealButton} - - ) : (<> - - {revealButton} - )} - - ); -}; - -export default ShowablePassword;