Skip to content

Expose position prop in DotTip component#14972

Merged
noisysocks merged 9 commits into
WordPress:masterfrom
HardeepAsrani:master
Jul 11, 2019
Merged

Expose position prop in DotTip component#14972
noisysocks merged 9 commits into
WordPress:masterfrom
HardeepAsrani:master

Conversation

@HardeepAsrani

@HardeepAsrani HardeepAsrani commented Apr 13, 2019

Copy link
Copy Markdown
Contributor

Description

This will expose the position prop in DotTip component which uses Popove component internally to make the popover.

How has this been tested?

It was tested with the default DotTip that are being used for NUX. It's worth mentioning that the positioning will only take place if space is available for it (it drove me mad because I thought it wasn't working).

Checklist:

  • My code is tested.
  • My code follows the WordPress code style.
  • My code follows the accessibility standards.
  • My code has proper inline documentation.
  • I've included developer documentation if appropriate.

Fixes #14923

@youknowriad youknowriad added Good First Review A PR that's suitable for someone looking to contribute for the first time by reviewing code [Feature] NUX Anything that impacts the new user experience labels Apr 15, 2019
@aduth

aduth commented Apr 24, 2019

Copy link
Copy Markdown
Member

I might like to know if there was some design rationale from the original implementation (#6631, #3670) for which the position would have been hard-coded. Adding "Needs Design Feedback".

@aduth aduth added the Needs Design Feedback Needs general design feedback. label Apr 24, 2019
@mapk mapk requested a review from karmatosed June 25, 2019 16:41
@karmatosed

Copy link
Copy Markdown
Member

I have done some digging into this and the reasoning isn't clear so I think based on that it should be likely to work exposing. I will cc in @noisysocks also as one of the originators of a lot of Tips code.

@noisysocks

noisysocks commented Jul 4, 2019

Copy link
Copy Markdown
Member

I have done some digging into this and the reasoning isn't clear so I think based on that it should be likely to work exposing. I will cc in @noisysocks also as one of the originators of a lot of Tips code.

The rationale was that I didn't need it so I didn't add it! 😀

It's worth mentioning that the positioning will only take place if space is available for it (it drove me mad because I thought it wasn't working).

This has bitten me before too! 😂

<Popover
className="nux-dot-tip"
position="middle right"
position={ position || 'middle right' }

@noisysocks noisysocks Jul 4, 2019

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

You could do this with a default argument if you want to make it more explicit that the argument is optional.

export function DotTip( {
	position = 'middle right',
	...
} ) {
	...

Totally up to you, though!

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

You could do this with a default argument if you want to make it more explicit that the argument is optional.

I'd agree this would probably be the best way to communicate it as an optional prop, and it may help future maintainability if there are changes to the component which reference position in more than this one location.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@aduth Should I make this change then?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@aduth Should I make this change then?

It would be a worthwhile improvement if you're willing, yes.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@aduth Made the changes. :)

@noisysocks noisysocks merged commit 99a7eb4 into WordPress:master Jul 11, 2019
@noisysocks

Copy link
Copy Markdown
Member

Thanks @HardeepAsrani!

@youknowriad youknowriad added this to the Gutenberg 6.2 milestone Jul 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Feature] NUX Anything that impacts the new user experience Good First Review A PR that's suitable for someone looking to contribute for the first time by reviewing code Needs Design Feedback Needs general design feedback.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

NUX DotTip Positioning

5 participants