Skip to content

Commit

Permalink
fixup! fixup! 💄(website) replace grommet input by cunningham input
Browse files Browse the repository at this point in the history
  • Loading branch information
AntoLC committed Sep 5, 2023
1 parent 137786e commit a4c09d3
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,29 +7,29 @@ import { ReactComponent as HideContent } from 'assets/svg/hide-content.svg';
import { ReactComponent as ShowContent } from 'assets/svg/show-content.svg';

const messages = defineMessages({
showPassword: {
revealPassword: {
defaultMessage: 'Show the password.',
description: 'A18n label for the password button.',
id: 'components.Text.PrivateTextInputfield.showCurrentPassword',
id: 'components.Text.PrivateTextInputfield.revealPassword',
},
hidePassword: {
obscurePassword: {
defaultMessage: 'Hide the password.',
description: 'A18n label for the hidden password button.',
id: 'components.Text.PrivateTextInputfield.hideCurrentPassword',
id: 'components.Text.PrivateTextInputfield.obscurePassword',
},
});

type InputProps = ComponentPropsWithRef<typeof Input>;

interface PrivateTextInputFieldProps extends InputProps {
showButtonLabel?: string;
hideButtonLabel?: string;
revealButtonLabel?: string;
obscureButtonLabel?: string;
}

export const PrivateTextInputField = ({
label,
showButtonLabel,
hideButtonLabel,
revealButtonLabel,
obscureButtonLabel,
...inputProps
}: PrivateTextInputFieldProps) => {
const intl = useIntl();
Expand All @@ -45,8 +45,9 @@ export const PrivateTextInputField = ({
<Button
a11yTitle={
isObscured
? showButtonLabel || intl.formatMessage(messages.showPassword)
: hideButtonLabel || intl.formatMessage(messages.hidePassword)
? revealButtonLabel || intl.formatMessage(messages.revealPassword)
: obscureButtonLabel ||
intl.formatMessage(messages.obscurePassword)
}
plain
style={{ margin: '0 1rem' }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,15 @@ const messages = defineMessages({
description: 'Label for new password text input.',
id: 'features.Profile.AccountSettings.newPassword',
},
showNewPassword: {
revealNewPassword: {
defaultMessage: 'Show new password',
description: 'A18n label for the show new password button.',
id: 'features.Profile.AccountSettings.showNewPassword',
id: 'features.Profile.AccountSettings.revealNewPassword',
},
hideNewPassword: {
obscureNewPassword: {
defaultMessage: 'Hide new password',
description: 'A18n label for the hide new password button.',
id: 'features.Profile.AccountSettings.hideNewPassword',
id: 'features.Profile.AccountSettings.obscureNewPassword',
},
passwordValidation: {
defaultMessage: 'Repeat new password',
Expand Down Expand Up @@ -161,10 +161,10 @@ export const AccountSettings = () => {
id="currentPassword"
name="currentPassword"
label={intl.formatMessage(messages.currentPassword)}
showButtonLabel={intl.formatMessage(
revealButtonLabel={intl.formatMessage(
messages.showCurrentPassword,
)}
hideButtonLabel={intl.formatMessage(
obscureButtonLabel={intl.formatMessage(
messages.hideCurrentPassword,
)}
state={error?.old_password ? 'error' : undefined}
Expand All @@ -177,8 +177,12 @@ export const AccountSettings = () => {
id="newPassword"
name="newPassword"
label={intl.formatMessage(messages.newPassword)}
showButtonLabel={intl.formatMessage(messages.showNewPassword)}
hideButtonLabel={intl.formatMessage(messages.hideNewPassword)}
revealButtonLabel={intl.formatMessage(
messages.revealNewPassword,
)}
obscureButtonLabel={intl.formatMessage(
messages.obscureNewPassword,
)}
state={error?.new_password1 ? 'error' : undefined}
text={error?.new_password1?.join(' ')}
value={values.newPassword}
Expand All @@ -189,10 +193,10 @@ export const AccountSettings = () => {
id="passwordValidation"
name="passwordValidation"
label={intl.formatMessage(messages.passwordValidation)}
showButtonLabel={intl.formatMessage(
revealButtonLabel={intl.formatMessage(
messages.showPasswordValidation,
)}
hideButtonLabel={intl.formatMessage(
obscureButtonLabel={intl.formatMessage(
messages.hidePasswordValidation,
)}
state={error?.new_password2 ? 'error' : undefined}
Expand Down

0 comments on commit a4c09d3

Please sign in to comment.