-
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
1 parent
8644001
commit 5e05469
Showing
7 changed files
with
505 additions
and
27 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,195 @@ | ||
import { useRef } from 'react'; | ||
import { useRouter } from 'next/router'; | ||
import { Menu } from '../../../lib/menu/Menu'; | ||
import { DocSectionCode } from '../../common/docsectioncode'; | ||
import { DocSectionText } from '../../common/docsectiontext'; | ||
import { Toast } from '../../../lib/toast/Toast'; | ||
|
||
export function PTDoc(props) { | ||
const toast = useRef(null); | ||
const router = useRouter(); | ||
const items = [ | ||
{ | ||
label: 'Options', | ||
items: [ | ||
{ | ||
label: 'Update', | ||
icon: 'pi pi-refresh', | ||
command: () => { | ||
toast.current.show({ severity: 'success', summary: 'Updated', detail: 'Data Updated', life: 3000 }); | ||
} | ||
}, | ||
{ | ||
label: 'Delete', | ||
icon: 'pi pi-times', | ||
command: () => { | ||
toast.current.show({ severity: 'warn', summary: 'Delete', detail: 'Data Deleted', life: 3000 }); | ||
} | ||
} | ||
] | ||
}, | ||
{ | ||
label: 'Navigate', | ||
items: [ | ||
{ | ||
label: 'React Website', | ||
icon: 'pi pi-external-link', | ||
url: 'https://reactjs.org/' | ||
}, | ||
{ | ||
label: 'Router', | ||
icon: 'pi pi-upload', | ||
command: () => { | ||
router.push('/fileupload'); | ||
} | ||
} | ||
] | ||
} | ||
]; | ||
|
||
const code = { | ||
basic: ` | ||
<Menu | ||
model={items} | ||
pt={{ | ||
submenuHeader: { className: 'text-primary' } | ||
}} | ||
/> | ||
`, | ||
javascript: ` | ||
import React, { useRef } from 'react'; | ||
import { useRouter } from 'next/router'; | ||
import { Menu } from 'primereact/menu'; | ||
import { Toast } from 'primereact/toast'; | ||
export default function PTDemo() { | ||
const items = [ | ||
{ | ||
label: 'Options', | ||
items: [ | ||
{ | ||
label: 'Update', | ||
icon: 'pi pi-refresh', | ||
command: () => { | ||
toast.current.show({ severity: 'success', summary: 'Updated', detail: 'Data Updated', life: 3000 }); | ||
} | ||
}, | ||
{ | ||
label: 'Delete', | ||
icon: 'pi pi-times', | ||
command: () => { | ||
toast.current.show({ severity: 'warn', summary: 'Delete', detail: 'Data Deleted', life: 3000 }); | ||
} | ||
} | ||
] | ||
}, | ||
{ | ||
label: 'Navigate', | ||
items: [ | ||
{ | ||
label: 'React Website', | ||
icon: 'pi pi-external-link', | ||
url: 'https://reactjs.org/' | ||
}, | ||
{ | ||
label: 'Router', | ||
icon: 'pi pi-upload', | ||
command: () => { | ||
router.push('/fileupload'); | ||
} | ||
} | ||
] | ||
} | ||
]; | ||
return ( | ||
<div className="card flex justify-content-center"> | ||
<Toast ref={toast} /> | ||
<Menu | ||
model={items} | ||
pt={{ | ||
submenuHeader: { className: 'text-primary' } | ||
}} | ||
/> | ||
</div> | ||
) | ||
} | ||
`, | ||
typescript: ` | ||
import React, { useRef } from 'react'; | ||
import { useRouter } from 'next/router'; | ||
import { Menu } from 'primereact/menu'; | ||
import { MenuItem } from 'primereact/menuitem'; | ||
import { Toast } from 'primereact/toast'; | ||
export default function PTDemo() { | ||
const items: MenuItem[] = [ | ||
{ | ||
label: 'Options', | ||
items: [ | ||
{ | ||
label: 'Update', | ||
icon: 'pi pi-refresh', | ||
command: () => { | ||
toast.current.show({ severity: 'success', summary: 'Updated', detail: 'Data Updated', life: 3000 }); | ||
} | ||
}, | ||
{ | ||
label: 'Delete', | ||
icon: 'pi pi-times', | ||
command: () => { | ||
toast.current.show({ severity: 'warn', summary: 'Delete', detail: 'Data Deleted', life: 3000 }); | ||
} | ||
} | ||
] | ||
}, | ||
{ | ||
label: 'Navigate', | ||
items: [ | ||
{ | ||
label: 'React Website', | ||
icon: 'pi pi-external-link', | ||
url: 'https://reactjs.org/' | ||
}, | ||
{ | ||
label: 'Router', | ||
icon: 'pi pi-upload', | ||
command: () => { | ||
router.push('/fileupload'); | ||
} | ||
} | ||
] | ||
} | ||
]; | ||
return ( | ||
<div className="card flex justify-content-center"> | ||
<Toast ref={toast} /> | ||
<Menu | ||
model={items} | ||
pt={{ | ||
submenuHeader: { className: 'text-primary' } | ||
}} | ||
/> | ||
</div> | ||
) | ||
} | ||
` | ||
}; | ||
|
||
return ( | ||
<> | ||
<DocSectionText {...props}></DocSectionText> | ||
<div className="card flex justify-content-center"> | ||
<Toast ref={toast} /> | ||
<Menu | ||
model={items} | ||
pt={{ | ||
submenuHeader: { className: 'text-primary' } | ||
}} | ||
/> | ||
</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,15 @@ | ||
|
||
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="menu" /> | ||
</div> | ||
</> | ||
); | ||
}; |
Oops, something went wrong.