Skip to content

Commit

Permalink
Fix #3892: Breadcrumb Doc Enhancements
Browse files Browse the repository at this point in the history
  • Loading branch information
habubey committed Jan 6, 2023
1 parent 7c741f2 commit f5aaefd
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 22 deletions.
22 changes: 5 additions & 17 deletions components/doc/breadcrumb/basicdoc.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { BreadCrumb } from '../../lib/breadcrumb/BreadCrumb';
import { DocSectionCode } from '../common/docsectioncode';
import { DocSectionText } from '../common/docsectiontext';

export function DefaultDoc(props) {
export function BasicDoc(props) {
const items = [{ label: 'Computer' }, { label: 'Notebook' }, { label: 'Accessories' }, { label: 'Backpacks' }, { label: 'Item' }];

const home = { icon: 'pi pi-home', url: 'https://www.primefaces.org/primereact/showcase' };
Expand All @@ -15,14 +15,8 @@ export function DefaultDoc(props) {
import React from 'react';
import { BreadCrumb } from 'primereact/breadcrumb';
export default function DefaultDoc() {
const items = [
{label: 'Computer'},
{label: 'Notebook'},
{label: 'Accessories'},
{label: 'Backpacks'},
{label: 'Item'}
];
export default function BasicDoc() {
const items = [{ label: 'Computer' }, { label: 'Notebook' }, { label: 'Accessories' }, { label: 'Backpacks' }, { label: 'Item' }];
const home = { icon: 'pi pi-home', url: 'https://www.primefaces.org/primereact/showcase' }
Expand All @@ -35,14 +29,8 @@ export default function DefaultDoc() {
import React from 'react';
import { BreadCrumb } from 'primereact/breadcrumb';
export default function DefaultDoc() {
const items = [
{label: 'Computer'},
{label: 'Notebook'},
{label: 'Accessories'},
{label: 'Backpacks'},
{label: 'Item'}
];
export default function BasicDoc() {
const items = [{ label: 'Computer' }, { label: 'Notebook' }, { label: 'Accessories' }, { label: 'Backpacks' }, { label: 'Item' }];
const home = { icon: 'pi pi-home', url: 'https://www.primefaces.org/primereact/showcase' }
Expand Down
56 changes: 56 additions & 0 deletions components/doc/breadcrumb/templatedoc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
import { BreadCrumb } from '../../lib/breadcrumb/BreadCrumb';
import { DocSectionCode } from '../common/docsectioncode';
import { DocSectionText } from '../common/docsectiontext';

export function TemplateDoc(props) {
const items = [{ className: ' pi pi-sitemap' }, { className: 'pi pi-book' }, { className: 'pi pi-wallet' }, { className: 'pi pi-shopping-bag' }, { className: 'pi pi-calculator' }];

const home = { icon: 'pi pi-home', url: 'https://www.primefaces.org/primereact/showcase' };

const code = {
basic: `
<BreadCrumb model={items} home={home} />
`,
javascript: `
import React from 'react';
import { BreadCrumb } from 'primereact/breadcrumb';
export default function TemplateDoc() {
const items = [{ className: ' pi pi-sitemap' }, { className: 'pi pi-book' }, { className: 'pi pi-wallet' }, { className: 'pi pi-shopping-bag' }, { className: 'pi pi-calculator' }];
const home = { icon: 'pi pi-home', url: 'https://www.primefaces.org/primereact/showcase' }
return (
<BreadCrumb model={items} home={home} />
)
}
`,
typescript: `
import React from 'react';
import { BreadCrumb } from 'primereact/breadcrumb';
export default function TemplateDoc() {
const items = [{ className: ' pi pi-sitemap' }, { className: 'pi pi-book' }, { className: 'pi pi-wallet' }, { className: 'pi pi-shopping-bag' }, { className: 'pi pi-calculator' }];
const home = { icon: 'pi pi-home', url: 'https://www.primefaces.org/primereact/showcase' }
return (
<BreadCrumb model={items} home={home} />
)
}
`
};

return (
<>
<DocSectionText {...props}>
{/* TO DO: Add demo content. */}
<p></p>
</DocSectionText>
<div className="card flex justify-content-center">
<BreadCrumb model={items} home={home} />
</div>
<DocSectionCode code={code} />
</>
);
}
15 changes: 10 additions & 5 deletions pages/breadcrumb/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ import { DocSectionNav } from '../../components/doc/common/docsectionnav';
import { DocSections } from '../../components/doc/common/docsections';
import { DocActions } from '../../components/doc/common/docactions';
import { ImportDoc } from '../../components/doc/breadcrumb/importdoc';
import { DefaultDoc } from '../../components/doc/breadcrumb/basicdoc';
import { BasicDoc } from '../../components/doc/breadcrumb/basicdoc';
import { ApiDoc } from '../../components/doc/breadcrumb/apipdoc';
import { TemplateDoc } from '../../components/doc/breadcrumb/templatedoc';

const BreadCrumbDemo = () => {
const docs = [
Expand All @@ -14,11 +15,15 @@ const BreadCrumbDemo = () => {
component: ImportDoc
},
{
id: 'Default',
label: 'Default',
component: DefaultDoc
id: 'basic',
label: 'Basic',
component: BasicDoc
},
{
id: 'template',
label: 'Template',
component: TemplateDoc
},

{
id: 'api',
label: 'API',
Expand Down

0 comments on commit f5aaefd

Please sign in to comment.