-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
🐾 Enhance the DetailsItem component to enable both hyperlink and edit #1122
🐾 Enhance the DetailsItem component to enable both hyperlink and edit #1122
Conversation
4ca8417
to
06917ca
Compare
Nice, my concern is that we will have two identical items that will behave differntly without visual indication, one will have "value"+"pencil" where the "value" will work as an "edit button", and in the other the "value" will work as "external link". Can you think of another way to have "value" as a "external link" while keeping only one behavior, maybe switching to only support the pencilOnlyButton mode ? |
Ref: #1124 |
The reason I used this "combined" solution is since other details pages used the same style. For example, check the Anyway, I agree that it's confusing and also suggested in main comment above to consider adding an 'Edit' label next to the pencil icon, as done for the Console's Screencast.from.2024-04-21.21-58-45.webmWDYT? |
That is an excellent suggestion and in line with the product plan, we can add an enhancement feature and prioritize according to our capacity. |
Adding |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please, make only one way of rendering the component, always separating the content from the icon button.
See: #1122 (comment)
Yes I agree. In general, I think it's confusing for the user to use 2 kind of edit button styles within the same page. |
06917ca
to
8cf7da4
Compare
{content} <Pencil className="forklift-page-details-edit-pencil" /> | ||
</DescriptionListDescription> | ||
</Button> | ||
export const EditableContentPencilOnlyButton: React.FC<{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
export const EditableContentPencilOnlyButton: React.FC<{ | |
export const EditableContentButton: React.FC<{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no need to change the element name, we only have one EditableContentButton
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I actually like to name the element with it's style, so that we will be able to add other styles in the future (e.g. w/o edit label etc) and since the console itself includes few edit styles already.
But if you think it's redundant then ok.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But if you think it's redundant then ok.
yes, I do :-)
* @param {ReactNode} content - The content of the button. | ||
* @param {Function} onEdit - Function to be called when the button is clicked. | ||
* @param {ReactNode} content - The field's content element. | ||
* @param {Function} onEdit - Function to be called when the button with the pencil icon is clicked. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* @param {Function} onEdit - Function to be called when the button with the pencil icon is clicked. | |
* @param {Function} onEdit - Function to be called when the button is clicked. |
we only have one button
Reference: kubev2v#1106 Up till now the DetailsItem component could support 2 modes: 1. A non editable content (w/o hyperlink). 2. An editable content while both content and pencil icon are inline button for triggering the onEdit callback. This PR enhances the DetailsItem component to replace the editable mode (2) style such that the field context is an element (can be a hyperlink button for example) and only the pencil icon is an inline button for triggering the onEdit callback. We can consider adding a 'Edit' label next to the pencil icon. Signed-off-by: Sharon Gratch <sgratch@redhat.com>
8cf7da4
to
1a86fa7
Compare
|
Updated the main comment with a screencast. |
References:
#1106
#1124
Up till now the
DetailsItem
component supported 2 modes:onEdit
callback.This PR enhances the
DetailsItem
component by replacing the editable mode style (2) such that only the pencil icon is an inline button for triggering theonEdit
callback, while the field's context element is now separated from the edit button and can be used as read only text element, a hyperlink button etc.Screencast of 2 examples for the editable mode usage (readable text and hyperlink)
Screencast.from.2024-04-24.17-44-09.webm
Future enhancement:
We can consider adding a 'Edit' label next to the pencil icon:
pencil icon with a label