Skip to content

Commit

Permalink
Refactor groupdoc for Menu
Browse files Browse the repository at this point in the history
Apply Prettier
  • Loading branch information
ulasturann committed May 17, 2023
1 parent 5e05469 commit 05b5074
Showing 1 changed file with 13 additions and 16 deletions.
29 changes: 13 additions & 16 deletions components/doc/menu/groupdoc.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,20 +46,21 @@ export function GroupDoc(props) {
]
}
];

const code = {
basic: `
<Toast ref={toast} />
<Menu model={items} />
`,
javascript: `
import React, { useRef } from 'react';
//import { useRouter } from 'next/router';
import { useRouter } from 'next/router';
import { Menu } from 'primereact/menu';
import { Toast } from 'primereact/toast';
export default function GroupDemo() {
const toast = useRef(null);
//const router = useRouter();
const router = useRouter();
const items = [
{
label: 'Options',
Expand All @@ -81,18 +82,18 @@ export default function GroupDemo() {
]
},
{
label: 'Navigate',
label: 'Links',
items: [
{
label: 'React Website',
icon: 'pi pi-external-link',
url: 'https://reactjs.org/'
},
{
label: 'Router',
label: 'Upload',
icon: 'pi pi-upload',
command () => {
//router.push('/fileupload');
command: () => {
router.push('/fileupload');
}
}
]
Expand All @@ -109,14 +110,14 @@ export default function GroupDemo() {
`,
typescript: `
import React, { useRef } from 'react';
//import { useRouter } from 'next/router';
import { useRouter } from 'next/router';
import { Menu } from 'primereact/menu';
import { MenuItem } from 'primereact/menuitem';
import { Toast } from 'primereact/toast';
export default function GroupDemo() {
const toast = useRef<Toast>(null);
//const router = useRouter();
const router = useRouter();
const items: MenuItem[] = [
{
label: 'Options',
Expand All @@ -138,18 +139,18 @@ export default function GroupDemo() {
]
},
{
label: 'Navigate',
label: 'Links',
items: [
{
label: 'React Website',
icon: 'pi pi-external-link',
url: 'https://reactjs.org/'
},
{
label: 'Router',
label: 'Upload',
icon: 'pi pi-upload',
command: () => {
//router.push('/fileupload');
router.push('/fileupload');
}
}
]
Expand All @@ -168,11 +169,7 @@ export default function GroupDemo() {

return (
<>
<DocSectionText {...props}>
<p>
Menu supports one level of nesting by defining children with <i>items</i> property.
</p>
</DocSectionText>
<DocSectionText {...props}></DocSectionText>
<div className="card flex justify-content-center">
<Toast ref={toast} />
<Menu model={items} />
Expand Down

0 comments on commit 05b5074

Please sign in to comment.