Skip to content

OBPIH-6024 Create a reusable TextInput component for Product Sources create/edit form#4496

Merged
awalkowiak merged 4 commits intofeature/product-supplier-list-redesignfrom
OBPIH-6024
Feb 7, 2024
Merged

OBPIH-6024 Create a reusable TextInput component for Product Sources create/edit form#4496
awalkowiak merged 4 commits intofeature/product-supplier-list-redesignfrom
OBPIH-6024

Conversation

@alannadolny
Copy link
Collaborator

No description provided.

Copy link
Collaborator

@kchelstowski kchelstowski left a comment

Choose a reason for hiding this comment

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

Could you also please include some screenshots of your beautiful work? 😄

</div>
{redirect && (
<div
onClick={() => history.push(redirect.redirectTo)}
Copy link
Collaborator

@kchelstowski kchelstowski Feb 7, 2024

Choose a reason for hiding this comment

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

We don't know on 100% if this is eventually always gonna be a React redirect, hence I think we should distinguish (maybe add an additional flag whether it's a "react link" or a gsp one to know, if we should use history.push or window.location).

Copy link
Collaborator Author

@alannadolny alannadolny Feb 7, 2024

Choose a reason for hiding this comment

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

Good point, maybe a better approach (instead of passing an additional flag) will be to pass the whole "redirect" function, it will increase the usability of this button (in the context of the fact that we can pass different functions than just redirecting one)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

image
image
image
image

Copy link
Collaborator

Choose a reason for hiding this comment

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

@alannadolny

will be to pass the whole "redirect" function, it will increase the usability of this button

I was also considering such an approach, so it'd be fine to me.

</div>
{button && (
<div
onClick={button.function}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
onClick={button.function}
onClick={button.onClick}

let's follow the react naming pattern for callback props that handle onClick functionality

id: PropTypes.string.isRequired,
defaultMessage: PropTypes.string.isRequired,
}),
// Hyperlink on the right side above the input
Copy link
Collaborator

Choose a reason for hiding this comment

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

after your last change this comment doesn't correspond to the usecase of this prop.

Comment on lines +81 to +85
tooltip: null,
required: false,
title: null,
button: null,
errorMessage: null,
Copy link
Collaborator

Choose a reason for hiding this comment

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

is there a reason we need to specify default prop values as null?
by default props that are not passed are undefined

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

If a prop is not required, the linter shouts that we have to specify the default prop.

ESLint: propType "..." is not required, but has no corresponding defaultProps declaration.(react/require-default-props)

Copy link
Collaborator

Choose a reason for hiding this comment

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

ok

<div
onClick={button.function}
role="presentation"
className="input-wrapper-redirect"
Copy link
Collaborator

Choose a reason for hiding this comment

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

after your last change input-wrapper-redirect is probably not an accurate description of this div

@awalkowiak awalkowiak merged commit 5e4d1e7 into feature/product-supplier-list-redesign Feb 7, 2024
@awalkowiak awalkowiak deleted the OBPIH-6024 branch February 7, 2024 14:54
awalkowiak pushed a commit that referenced this pull request Mar 12, 2024
…create/edit form (#4496)

* OBPIH-6024 Add text field and wrapper for input fields

* OBPIH-6024 Add styling for text input field

* OBPIH-6024 Change redirect argument to passed function

* OBPIH-6024 Changes after review
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.

4 participants