-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
443 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
import React, { useState, useRef } from 'react'; | ||
import { DocSectionText } from '../../common/docsectiontext'; | ||
import { DocSectionCode } from '../../common/docsectioncode'; | ||
import { Toast } from '../../../lib/toast/Toast'; | ||
import { ConfirmDialog } from '../../../lib/confirmdialog/ConfirmDialog'; | ||
import { Button } from '../../../lib/button/Button'; | ||
|
||
export function PTDoc(props) { | ||
const [visible, setVisible] = useState(false); | ||
const toast = useRef(null); | ||
|
||
const accept = () => { | ||
toast.current.show({ severity: 'info', summary: 'Confirmed', detail: 'You have accepted', life: 3000 }); | ||
}; | ||
|
||
const reject = () => { | ||
toast.current.show({ severity: 'warn', summary: 'Rejected', detail: 'You have rejected', life: 3000 }); | ||
}; | ||
|
||
const code = { | ||
basic: ` | ||
<ConfirmDialog | ||
pt={{ headerTitle: { className: 'text-primary' } }} | ||
visible={visible} | ||
onHide={() => setVisible(false)} | ||
message="Are you sure you want to proceed?" | ||
header="Confirmation" | ||
icon="pi pi-exclamation-triangle" | ||
accept={accept} | ||
reject={reject} | ||
/> | ||
<div className="card flex justify-content-center"> | ||
<Button onClick={() => setVisible(true)} icon="pi pi-check" label="Confirm" /> | ||
</div> | ||
`, | ||
javascript: ` | ||
import React, { useRef, useState } from 'react'; | ||
import { Toast } from 'primereact/toast'; | ||
import { Button } from 'primereact/button'; | ||
import { ConfirmDialog } from 'primereact/confirmdialog'; | ||
export default function PTDemo() { | ||
return ( | ||
<> | ||
<Toast ref={toast} /> | ||
<ConfirmDialog | ||
pt={{ headerTitle: { className: 'text-primary' } }} | ||
visible={visible} | ||
onHide={() => setVisible(false)} | ||
message="Are you sure you want to proceed?" | ||
header="Confirmation" | ||
icon="pi pi-exclamation-triangle" | ||
accept={accept} | ||
reject={reject} | ||
/> | ||
<div className="card flex justify-content-center"> | ||
<Button onClick={() => setVisible(true)} icon="pi pi-check" label="Confirm" /> | ||
</div> | ||
</> | ||
) | ||
} | ||
`, | ||
typescript: ` | ||
import React, { useRef, useState } from 'react'; | ||
import { Toast } from 'primereact/toast'; | ||
import { Button } from 'primereact/button'; | ||
import { ConfirmDialog } from 'primereact/confirmdialog'; | ||
export default function PTDemo() { | ||
return ( | ||
<> | ||
<Toast ref={toast} /> | ||
<ConfirmDialog | ||
pt={{ headerTitle: { className: 'text-primary' } }} | ||
visible={visible} | ||
onHide={() => setVisible(false)} | ||
message="Are you sure you want to proceed?" | ||
header="Confirmation" | ||
icon="pi pi-exclamation-triangle" | ||
accept={accept} | ||
reject={reject} | ||
/> | ||
<div className="card flex justify-content-center"> | ||
<Button onClick={() => setVisible(true)} icon="pi pi-check" label="Confirm" /> | ||
</div> | ||
</> | ||
) | ||
} | ||
` | ||
}; | ||
|
||
return ( | ||
<> | ||
<DocSectionText {...props}></DocSectionText> | ||
<Toast ref={toast} /> | ||
<ConfirmDialog | ||
pt={{ headerTitle: { className: 'text-primary' } }} | ||
visible={visible} | ||
onHide={() => setVisible(false)} | ||
message="Are you sure you want to proceed?" | ||
header="Confirmation" | ||
icon="pi pi-exclamation-triangle" | ||
accept={accept} | ||
reject={reject} | ||
/> | ||
<div className="card flex justify-content-center"> | ||
<Button onClick={() => setVisible(true)} icon="pi pi-check" label="Confirm" /> | ||
</div> | ||
<DocSectionCode code={code} /> | ||
</> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import React from 'react'; | ||
import { DocSectionText } from '../../common/docsectiontext'; | ||
|
||
export const Wireframe = (props) => { | ||
return ( | ||
<> | ||
<DocSectionText {...props} /> | ||
<div> | ||
<img className="w-full" src="https://primefaces.org/cdn/primereact/images/pt/wireframe-placeholder.jpg" alt="confirmdialog" /> | ||
</div> | ||
</> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.