Skip to content

Commit

Permalink
Refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
mertsincan committed Nov 6, 2021
1 parent b036b6b commit 722aa63
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/showcase/confirmpopup/ConfirmPopupDemo.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export class ConfirmPopupDemo extends Component {
<AppInlineHeader changelogText="confirmPopup">
<h1>ConfirmPopup</h1>
<p>ConfirmPopup displays a confirmation overlay displayed relatively to its target.</p>
</AppInlineHeader>
</AppInlineHeader>
<AppDemoActions github="confirmpopup/ConfirmPopupDemo.js" />
</div>

Expand Down
24 changes: 24 additions & 0 deletions src/showcase/confirmpopup/ConfirmPopupDoc.js
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,31 @@ const confirm = (event) => {
<Button onClick={confirm} icon="pi pi-check" label="Confirm"></Button>
`}
</CodeHighlight>
<p>The confirmPopup method returns an object incudes <i>hide</i> and <i>show</i> methods. The component can be shown or hidden by using this object at any time.</p>

<CodeHighlight lang="js">
{`
const confirm = (event) => {
const myConfirm = confirmPopup({
target: event.currentTarget,
message: 'Are you sure you want to proceed?',
icon: 'pi pi-exclamation-triangle',
accept: () => acceptFunc(),
reject: () => rejectFunc()
});
setTimeout(() => {
myConfirm.hide();
setTimeout(() => {
myConfirm.show();
}, 1000);
}, 500);
}
<Button onClick={confirm} icon="pi pi-check" label="Confirm"></Button>
`}
</CodeHighlight>
<h6>2. &lt;ConfirmPopup&gt; tag</h6>
<p>ConfirmPopup is used as a container and visibility is managed with <i>visible</i> property where <i>onHide</i> event is required to update the visibility state.</p>

Expand Down

0 comments on commit 722aa63

Please sign in to comment.