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

breaking(popup): verticalOffset #2450

Merged
merged 4 commits into from
Feb 4, 2018

Conversation

adam-26
Copy link
Contributor

@adam-26 adam-26 commented Jan 20, 2018

Breaking Change

Popup must rename the offset property to horizontalOffset

Before

<Popup offset={10} />

After

<Popup horizontalOffset={10} />

Add a verticalOffset prop to the popup component.

Fixes #2449.

Add a verticalOffset prop to the popup.
@codecov-io
Copy link

codecov-io commented Jan 20, 2018

Codecov Report

Merging #2450 into master will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2450      +/-   ##
==========================================
+ Coverage   99.73%   99.74%   +<.01%     
==========================================
  Files         154      154              
  Lines        2692     2696       +4     
==========================================
+ Hits         2685     2689       +4     
  Misses          7        7
Impacted Files Coverage Δ
src/modules/Popup/Popup.js 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d077a17...fa2832c. Read the comment docs.

@levithomason
Copy link
Member

Great, thanks for this! We had this same PR submitted some time ago and never finished.

In an effort to keep the API consistent, let's consider a prop rename/restructure here. Currently, we have offset for horizontal values and verticalOffset for vertical values. Preferably, these would be more consistent.

Option 1

Rename offset to horizontalOffset. Downside, it is a breaking change. Upside, it is explicit, consistent, and fits the SUI tone.

<Popup horizontalOffset={} verticalOffset={} />

Option 2

Allow offset to accept an object. Downside, it is a little magical and nested prop values aren't ideal. Upside, it is concise, maps to DOM element position values, and is not a breaking change.

<Popup offset={10} />                // horizontal
<Popup offset={{ x: 10, y: 20 }} />  // horizontal, vertical

Thoughts?

@levithomason
Copy link
Member

Heads up, this is actually a duplicate of #2444. I'll let the PR authors decide on which PR to focus efforts.

@adam-26
Copy link
Contributor Author

adam-26 commented Jan 25, 2018

@levithomason, I think option 1 fits best with SUI. Why not just add ‘horizontalOffset’ as an alias to offset? This way, it’s not a breaking change. You could add a warning about using ‘offset’ and deprecate it in a future version?

@levithomason
Copy link
Member

Option 1 it is 👍. We don't support backward compatibility while in development (0.x) so no need to alias.

@levithomason
Copy link
Member

Our changelog is auto-linked to PRs. So that users can easily identify breaking changes and upgrade accordingly, we include a very brief description of why we are breaking the API and a before/after snippet. Example PR here #1791.

Let's update the description is this PR as well.

Rename `offset` to `horizontalOffset` for consistency.
@adam-26
Copy link
Contributor Author

adam-26 commented Jan 30, 2018

@levithomason please review changes, and that the PR description is correctly formatted for the change log.

This also resolves #2444.

Update docs for `horizontalOffset` and the new `verticalOffset` property.
@levithomason
Copy link
Member

The fourth offset example, vertical 50 from bottom center, seems to misbehave. The Popup appears then disappears immediately afterward. This is the snippet:

<Popup
  trigger={<Icon size='large' name='heart' circular />}
  content='As expected this popup is way off to the bottom'
  verticalOffset={50}
  position='bottom center'
/>

However, when changed to -50, it behaves correctly and is positioned far below as it should be. Seems there is a bug there.

Stop popup disappearing when vertical offset applied.
@adam-26
Copy link
Contributor Author

adam-26 commented Feb 2, 2018

@levithomason bug is now fixed and tested. Please review again.

@levithomason
Copy link
Member

Awesome, this looks great. Thanks much!

@levithomason levithomason merged commit 5168f95 into Semantic-Org:master Feb 4, 2018
@levithomason levithomason changed the title feat(popup): verticalOffset breaking(popup): verticalOffset Feb 4, 2018
levithomason pushed a commit that referenced this pull request Feb 4, 2018
* feat(popup): verticalOffset

Add a verticalOffset prop to the popup.

* feat(popup): Rename offset prop

Rename `offset` to `horizontalOffset` for consistency.

* docs(popup): Update for offset

Update docs for `horizontalOffset` and the new `verticalOffset` property.

* fix(popup): vertical offset bug

Stop popup disappearing when vertical offset applied.
@levithomason
Copy link
Member

Released in semantic-ui-react@v0.78.0.

Brantron pushed a commit to Brantron/Semantic-UI-React that referenced this pull request Mar 14, 2018
* feat(popup): verticalOffset

Add a verticalOffset prop to the popup.

* feat(popup): Rename offset prop

Rename `offset` to `horizontalOffset` for consistency.

* docs(popup): Update for offset

Update docs for `horizontalOffset` and the new `verticalOffset` property.

* fix(popup): vertical offset bug

Stop popup disappearing when vertical offset applied.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants