-
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
8 changed files
with
589 additions
and
34 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,98 @@ | ||
import { useRef } from 'react'; | ||
import { Button } from '../../../lib/button/Button'; | ||
import { Toast } from '../../../lib/toast/Toast'; | ||
import { DocSectionCode } from '../../common/docsectioncode'; | ||
import { DocSectionText } from '../../common/docsectiontext'; | ||
|
||
export function PTDoc(props) { | ||
const toast = useRef(null); | ||
|
||
const show = () => { | ||
toast.current.show({ | ||
severity: 'info', | ||
summary: 'Info', | ||
detail: 'Message Content', | ||
pt: { | ||
root: ({ index }) => ({ className: `bg-yellow-${((index > 5 && 5) || index || 1) * 100}` }) | ||
} | ||
}); | ||
}; | ||
|
||
const code = { | ||
basic: ` | ||
<Toast | ||
ref={toast} | ||
pt={{ | ||
message: ({ index }) => ({ className: \`bg-yellow-\${((index > 5 && 5) || index || 1) * 100}\` }) | ||
}} | ||
/> | ||
<Button onClick={show} label="Show" /> | ||
`, | ||
javascript: ` | ||
import React, { useRef } from 'react'; | ||
import { Button } from 'primereact/button'; | ||
import { Toast } from 'primereact/toast'; | ||
export default function PTDemo() { | ||
const toast = useRef(null); | ||
const show = () => { | ||
toast.current.show({ severity: 'info', summary: 'Info', detail: 'Message Content' }); | ||
}; | ||
return ( | ||
<div className="card flex justify-content-center"> | ||
<Toast | ||
ref={toast} | ||
pt={{ | ||
message: ({ index }) => ({ className: \`bg-yellow-\${((index > 5 && 5) || index || 1) * 100}\` }) | ||
}} | ||
/> | ||
<Button onClick={show} label="Show" /> | ||
</div> | ||
) | ||
} | ||
`, | ||
typescript: ` | ||
import React, { useRef } from 'react'; | ||
import { Button } from 'primereact/button'; | ||
import { Toast } from 'primereact/toast'; | ||
export default function PTDemo() { | ||
const toast = useRef(null); | ||
const show = () => { | ||
toast.current.show({ severity: 'info', summary: 'Info', detail: 'Message Content' }); | ||
}; | ||
return ( | ||
<div className="card flex justify-content-center"> | ||
<Toast | ||
ref={toast} | ||
pt={{ | ||
message: ({ index }) => ({ className: \`bg-yellow-\${((index > 5 && 5) || index || 1) * 100}\` }) | ||
}} | ||
/> | ||
<Button onClick={show} label="Show" /> | ||
</div> | ||
) | ||
} | ||
` | ||
}; | ||
|
||
return ( | ||
<> | ||
<DocSectionText {...props}></DocSectionText> | ||
<div className="card flex justify-content-center"> | ||
<Toast | ||
ref={toast} | ||
pt={{ | ||
message: ({ index }) => ({ className: `bg-yellow-${((index > 5 && 5) || index || 1) * 100}` }) | ||
}} | ||
/> | ||
<Button onClick={show} label="Show" /> | ||
</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="toast" /> | ||
</div> | ||
</> | ||
); | ||
}; |
Oops, something went wrong.