-
Notifications
You must be signed in to change notification settings - Fork 7
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(inline-edit): allow to render IconField
#993
Conversation
🦋 Changeset detectedLatest commit: e51f3bc The changes in this PR will be included in the next version bump. This PR includes changesets to release 7 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
IconField
Size Change: +706 B (0%) Total Size: 171 kB
ℹ️ View Unchanged
|
|
||
const renderIcon = tooltip ? ( | ||
<Tooltip content={tooltip} targetClassName={styles.iconFieldButton}> | ||
<IconButton |
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.
Did you mean to make this into a button? Will users interact with it? (It looks like you can't pass onClick
to this specific component for example.)
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.
Yeah tooltips must have an interactable element as the target/trigger. onClick
isn't needed as Tooltip
already adds listeners for hover/focus to show the content.
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 was playing in storybook, and it surprised me that i could click on the icon.
@@ -88,6 +84,28 @@ select.formInput { | |||
border-color: var(--lp-color-border-field-error); | |||
} | |||
|
|||
.iconField:global(.IconBefore) .formInput { | |||
padding-left: 3rem; |
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.
should we use the specing tokens here?
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.
We don't have one for 3rem 😅
mergeProps(renderInput.props, inputChildren ? {} : inputProps), | ||
inputChildren && | ||
Children.map(inputChildren, (child) => | ||
['TextField', 'TextArea'].includes(child.type.displayName) |
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.
Why do we need to reach for the display name here? Is reading displayName
this way reliable post-bundling, etc…
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.
@apucacao, I'm guessing this is to check that, if it's an expected Launchpad-based React element, then we merge its props with the inputProps
we need. I don't know anything about bundling effects on this.
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.
Yeah, I figured.
I was wondering why child.type === TextField
wouldn't work. We'd need to import TextField
.
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.
LP component display names aren't minified in the product but just to be safe I can check for the type to match the component itself.
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.
Summary
Allow
InlineEdit
to renderIconField
. Addtooltip
andrenderIconLast
props toIconField
.Screenshots (if appropriate):