-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
docs(Modal): Add controlled modal example #769
docs(Modal): Add controlled modal example #769
Conversation
Current coverage is 100% (diff: 100%)
|
You can read about docs in the contributing guide: |
import React, { Component } from 'react' | ||
import { Button, Header, Icon, Modal } from 'semantic-ui-react' | ||
|
||
export default class ModalControlledExample extends Component { |
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.
Class name should match the file name.
Let me know if you have any other questions. |
I've added the reference for the It looks like this has broken some of the functionality of the Modal component, as the changes to the @levithomason does the Modal component need a lifecycle method similar to that in the Dropdown component? Apologies if I've missed something simple here! |
Previously the Now that the prop is being "handled" (added to the propTypes), you'll need to destructure it from props and pass it manually. It is no longer captured in the Clarification, |
Thanks for the clarification @levithomason! The controlled component now works 👍 What's the best way to maintain the functionality in the uncontrolled components, where I've been looking at the pattern of |
@lewisblackwood - previously the modal was passing If the tests are all passing and the examples still work on this branch, you should be g2g. If not, maybe I'm misunderstanding how |
Sorry @jcarbo, I should have been clearer above: I'm finding that the uncontrolled modal examples in the docs don't open on this branch (despite the passing tests). The controlled examples (mine and those under the 'Variations' header) are working. |
@lewisblackwood - indeed my understanding of AutoControlledComponent was wrong. I opened a PR with a potential fix and further discussion on how to handle this type of behavior: #788 |
@lewisblackwood there have been some updates to the Modal, you might want merge or rebase to the latest master to keep this PR up to speed. It looks like there are some conflicts. |
@levithomason thanks for the heads-up; I've rebased this PR. Just waiting to see the outcome of #788 as this PR still breaks the uncontrolled modal right now. |
@lewisblackwood this PR should be unblocked and ready to update to the latest master. Give it a whirl and LMK how it goes. Details in #788. |
@levithomason rad! All the modal examples are working now, this should be good to merge 👍 |
Fixed a typo in the prop description, will ship on pass. Thanks much 🎉 |
An example of a controlled modal component utilising the open prop. Fixes #690.
@levithomason could you advise on how to include
open
in the prop table at the top of the document?