-
-
Notifications
You must be signed in to change notification settings - Fork 9.5k
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
Viewport-addon Allow setting callback to be called whenever viewport changes #3283
Conversation
Please fix unit tests |
@Hypnosphi thanks for reviewing! I'm going to fix/add old/new tests probably today |
Codecov Report
@@ Coverage Diff @@
## master #3283 +/- ##
==========================================
+ Coverage 35.33% 35.69% +0.36%
==========================================
Files 470 472 +2
Lines 10018 10104 +86
Branches 944 965 +21
==========================================
+ Hits 3540 3607 +67
- Misses 5879 5880 +1
- Partials 599 617 +18
Continue to review full report at Codecov.
|
ca849dd
to
c505637
Compare
3a00773
to
a5f59f7
Compare
@Hypnosphi I've fixed old tests, added new ones, added stories, and updated documentation. Please take a look. P.S there is something weird with |
It says "PR is marked with "in progress" label." =) |
@@ -15,55 +15,63 @@ export const INITIAL_VIEWPORTS = { | |||
margin: '0', | |||
boxShadow: 'none', | |||
}, | |||
type: 'desktop', |
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.
Is this property documented anywhere?
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.
AFAIK Viewport
definition is not documented, so it's a good idea to start doing so
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.
Done
@@ -18,10 +20,26 @@ storiesOf('Addons|Viewport.Custom Default (Kindle Fire 2)', module) | |||
I've inherited <b>Kindle Fire 2</b> viewport from my parent. | |||
</Panel> | |||
)) | |||
.add('Overridden', () => ( | |||
<Viewport name="iphone6"> |
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.
Does Viewport
still work? If so, let's keep a story using it
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, it makes sense
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.
Done
- withViewport decorator - Viewport component - Viewport model definition
Issue: #3223
@SimenB Please also review
What I did
Add the ability to pass
onViewportChange
callback towithViewport
decorator, which will be called whenever viewport changes.Signature
It has the following signature
How to use
Either with global decorator (
recommended
), or per story... and below is a screenshot from the storybook
How to test
yarn test
Is this testable with jest or storyshots?
Yes
Does this need a new example in the kitchen sink apps?
Yes and added to
Viewports
-addon storiesDoes this need an update to the documentation?
Yes and added
If your answer is yes to any of these, please make sure to include it in your PR.