Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(PasswordInput): add component #1745

Merged
merged 14 commits into from
Nov 15, 2024
Merged

feat(PasswordInput): add component #1745

merged 14 commits into from
Nov 15, 2024

Conversation

NasgulNexus
Copy link
Contributor

No description provided.

@gravity-ui-bot
Copy link
Contributor

Preview is ready.

@gravity-ui-bot
Copy link
Contributor

Visual Tests Report is ready.

@NasgulNexus NasgulNexus changed the title Password input feat(Password input): add input Aug 12, 2024
src/components/controls/PasswordInput/README.md Outdated Show resolved Hide resolved
src/components/controls/PasswordInput/README.md Outdated Show resolved Hide resolved
src/components/controls/PasswordInput/README.md Outdated Show resolved Hide resolved
src/components/controls/PasswordInput/README.md Outdated Show resolved Hide resolved
}, []);

return (
<div className={b()}>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use Flex component, no need to add className or any styles

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

made via flex

@@ -0,0 +1,7 @@
.password-input-stories {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can be done without styles, see message above

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

deleted this style file

import en from './en.json';
import ru from './ru.json';

const COMPONENT = 'passwordInput';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const COMPONENT = 'passwordInput';
const COMPONENT = 'PasswordInput';


import {PasswordInputStories} from './helpersPlaywright';

test.describe('PasswordInputStories', () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
test.describe('PasswordInputStories', () => {
test.describe('PasswordInput', () => {

@NasgulNexus
Copy link
Contributor Author

@ValeraS Hi, can you take a look?

src/components/controls/PasswordInput/PasswordInput.tsx Outdated Show resolved Hide resolved
const additionalEndContent = (
<React.Fragment>
{endContent || rightContent}
{inputValue && showCopyButton ? (
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
{inputValue && showCopyButton ? (
{inputValue && showCopyButton && !props.disabled ? (

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as for me, the disable should only restrict the input of a value, copying is blocked separately

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Disabled controls are not interactive. If you need to interact with a control without the ability to edit it, there is a readOnly property for that.

Comment on lines 57 to 59
const onClick = () => {
setHideValue((hideValue) => !hideValue);
};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's focus input after click on the buttons or at least prevent default behaviour onMouseDown like here @amje

@vvtimofeev
Copy link
Contributor

@NasgulNexus hey, can you look back to this issue, please?

@NasgulNexus
Copy link
Contributor Author

@ValeraS Hi! Corrected comments added revealValue

const {actionButtonSize, iconSize} = getActionButtonSizeAndIconSize(size);

const onClick: React.MouseEventHandler<HTMLButtonElement> = (event) => {
event.preventDefault();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

preventDefault should be on mouse down

Comment on lines 46 to 47
hasCopyTooltip = true,
hasRevealTooltip = true,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@amje @korvin89 What do we want to do here, remove default values, rename props or do nothing?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest

  • to rename hasCopyTooltip to showCopyTooltip and remove default. I think there is no need in this element by default
  • to rename hasRevealTooltip to showRevealTooltip and remove default. I think we can hide this eleement by default

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

@vvtimofeev
Copy link
Contributor

@NasgulNexus @ValeraS @amje please, come back to this PR.

@amje amje changed the title feat(Password input): add input feat(PasswordInput): add component Nov 7, 2024
@korvin89 korvin89 merged commit 2e7f2c7 into main Nov 15, 2024
6 checks passed
@korvin89 korvin89 deleted the password-input branch November 15, 2024 13:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants