-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #966 from takenet/developer
Developer
- Loading branch information
Showing
5 changed files
with
178 additions
and
26 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,44 @@ | ||
import { | ||
Story, | ||
ArgsTable, | ||
Canvas, | ||
Meta, | ||
Title, | ||
Subtitle, | ||
Description, | ||
Primary, | ||
Controls, | ||
Stories, | ||
Source, | ||
} from '@storybook/blocks'; | ||
import * as BreadcrumbStories from './breadcrumb.stories'; | ||
|
||
# Breadcrumb | ||
|
||
[Component Detail](https://design.blip.ai/document/13#/breadcrumb/visao-geral-breadcrumb) | ||
| | ||
[Component Design](https://design.blip.ai/d/UbKsV1JhXTK4/design-1#/breadcrumb/resumo-breadcrumb) | ||
| | ||
[Accessibility](https://design.blip.ai/d/UbKsV1JhXTK4/design-1#/breadcrumb/acessibilidade-breadcrumb) | ||
|
||
## Overview | ||
|
||
Breadcrumbs provide a navigational aid to help users understand their location within the hierarchy of a website or app and easily move back to higher levels of that hierarchy. | ||
|
||
<Canvas of={BreadcrumbStories.Properties}></Canvas> | ||
|
||
<Meta isTemplate /> | ||
|
||
The following properties are available for the Breadcrumb component. | ||
|
||
<Controls /> | ||
|
||
## Events | ||
|
||
Some examples of Breadcrumb Events. | ||
|
||
<Source of={BreadcrumbStories.Events} /> | ||
|
||
## Build on React | ||
|
||
<Source of={BreadcrumbStories.FrameworkReact} /> |
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 { useState } from 'react'; | ||
import DocumentationTemplate from './breadcrumb.mdx'; | ||
import { BdsBreadcrumb } from '../../../blip-ds-react/dist/components'; | ||
|
||
export default { | ||
title: 'Components/Breadcrumb', | ||
tags: ['autodocs'], | ||
parameters: { | ||
docs: { | ||
page: DocumentationTemplate, | ||
}, | ||
}, | ||
}; | ||
|
||
export const Properties = (args) => { | ||
return ( | ||
<bds-breadcrumb | ||
items={args.items} | ||
></bds-breadcrumb> | ||
); | ||
}; | ||
|
||
Properties.argTypes = { | ||
items: { | ||
table: { | ||
defaultValue: { summary: '' }, | ||
}, | ||
description: 'Define the labels and hrefs for the breadcrumb items.', | ||
control: { type: 'text' }, | ||
}, | ||
}; | ||
|
||
Properties.args = { | ||
items: JSON.stringify([ | ||
{ label: 'Home', href: '/' }, | ||
{ label: 'About', href: '/about' }, | ||
{ label: 'Contact', href: '/contact' }, | ||
{ label: 'Current Page' }, | ||
]), | ||
}; | ||
|
||
export const Events = () => { | ||
const [clickedItem, setClickedItem] = useState(null); | ||
|
||
const handleBreadcrumbClick = (event) => { | ||
const detail = event.detail; | ||
setClickedItem(detail); | ||
console.log('Breadcrumb item clicked:', detail); | ||
}; | ||
|
||
return ( | ||
<div> | ||
<bds-breadcrumb | ||
items={JSON.stringify([ | ||
{ label: 'Home', href: '/' }, | ||
{ label: 'Features', href: '/features' }, | ||
{ label: 'Pricing', href: '/pricing' }, | ||
{ label: 'Documentation' }, | ||
])} | ||
onBreadcrumbItemClick={(event) => handleBreadcrumbClick(event)} | ||
></bds-breadcrumb> | ||
{clickedItem && ( | ||
<div> | ||
<p> | ||
You clicked on: <strong>{clickedItem.label}</strong> | ||
{clickedItem.href && ( | ||
<span> | ||
{' '} | ||
(<a href={clickedItem.href}>{clickedItem.href}</a>) | ||
</span> | ||
)} | ||
</p> | ||
</div> | ||
)} | ||
</div> | ||
); | ||
}; | ||
|
||
export const FrameworkReact = () => { | ||
const breadcrumbItems = [ | ||
{ label: 'Dashboard', href: '/dashboard' }, | ||
{ label: 'Settings', href: '/settings' }, | ||
{ label: 'Profile', href: '/profile' }, | ||
{ label: 'Edit Profile' }, | ||
]; | ||
|
||
const handleBreadcrumbClick = (event) => { | ||
const detail = event.detail; | ||
console.log('React Breadcrumb item clicked:', detail); | ||
}; | ||
|
||
return ( | ||
<BdsBreadcrumb | ||
items={breadcrumbItems} | ||
onBreadcrumbItemClick={(event) => handleBreadcrumbClick(event)} | ||
/> | ||
); | ||
}; |
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