-
Notifications
You must be signed in to change notification settings - Fork 4k
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(Tab): change menu.aligned prop to menuPosition and infer menu.tabular from it #2499
breaking(Tab): change menu.aligned prop to menuPosition and infer menu.tabular from it #2499
Conversation
💖 Thanks for opening this pull request! 💖 Here is a list of things that will help get it across the finish line:
We get a lot of pull requests on this repo, so please be patient and we will get back to you as soon as we can. |
Codecov Report
@@ Coverage Diff @@
## master #2499 +/- ##
==========================================
+ Coverage 99.74% 99.74% +<.01%
==========================================
Files 160 160
Lines 2758 2762 +4
==========================================
+ Hits 2751 2755 +4
Misses 7 7
Continue to review full report at Codecov.
|
Any feedback on prop name? |
Ah, yes, |
Done! |
Vertical ExampleThis example shows the tabs on the wrong side of the pane. http://localhost:8080/modules/tab#tab-example-vertical-true It seems we also have conflicting configuration now between the props |
I see, we'll still need I think it would be ideal to infer the |
But why? If there is no
OK. We |
src/modules/Tab/Tab.js
Outdated
const { activeIndex } = this.state | ||
|
||
if (menu.tabular === true) { | ||
menu.tabular = menuPosition === 'left' || 'right' | ||
} |
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.
menu.tabular = menuPosition === 'left' || 'right'
since there is no support for value 'left'
in menu.tabular
, we cannot set menu.tabular
as 'left'
AND menuPosition
as 'right'
src/modules/Tab/Tab.js
Outdated
@@ -114,7 +114,7 @@ class Tab extends Component { | |||
const { activeIndex } = this.state | |||
|
|||
if (menu.tabular === true) { | |||
menu.tabular = menuPosition === 'left' || 'right' | |||
menu.tabular = menuPosition | |||
} |
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.
menu.tabular = menuPosition
this way we can specify menu.tabular
as true
if we just want to infer it from menuPosition
and as left
or right
if we want to specify ourselves
Now |
I'd like to see |
@levithomason I'll update the rest of the code if it's OK now. |
While I agree, let's save this for another PR. There are many cases of props taking boolean values along with a "right" or "bottom" but not accepting a "left" or "top". The only other comment I have here is that I think we need to simplify the prop computation. The prop description has too many considerations given the scope of the feature (positioning the menu). Ideally, the user wouldn't have to think or make decisions beyond a left/right decision for the position. Anything more than this I feel reduces the utility of the component. I apologize I as I don't have time to offer suggestions at the moment. Feel free to offer your thoughts on this. |
@amankkg How's your availability looking for wrapping this one up? |
Oh, sorry for delay. I'll continue this asap 😎
…On Mon, Feb 19, 2018, 3:12 AM Levi Thomason ***@***.***> wrote:
@amankkg <https://github.com/amankkg> How's your availability looking for
wrapping this one up?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#2499 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ADwDZEasq94XjLpAloylMig-U-TwwaBcks5tWJI6gaJpZM4R7fAq>
.
|
Yep, sure. |
@levithomason there is an ugly prop computation because of
Not sure if this can simplified without decreasing Any comments and proposals are welcome, especially on props description in documentation. upd: example case |
Updated test cases and added new example for |
This looks great! I will do some cleanup and merge this today. |
9ad74c0
to
c76ed41
Compare
Added/updated docs, updated logic a bit and tests. Now |
@levithomason what is the status of this PR? What can I do to help? |
Sorry for the delay. Merging master and running tests and we'll ship this! |
98031df
to
148f973
Compare
Rebased and updated. Really hoping to merge this now... |
…React into fix/tab-menu-warning-redundant-prop-aligned
Removed cruft example, tests passed 👍 |
Released in |
BREAKING CHANGE
The
menu.aligned
prop has been replaced withmenuPosition
. This keeps themenu
prop strictly equal to the<Menu />
's props.Before
After
The current implementation of
Tab
'smenu
.aligned
prop triggers React's design-time warning on redundantaligned
prop being passed down todiv
of underlyingMenu
.In this change new dedicated
menuPosition
prop is introduced and oldmenu
.aligned
prop is removed.Remaining behavior is not changed:
PropTypes.oneOf(['left', 'right'])
'left'
Resolves #2430