-
Notifications
You must be signed in to change notification settings - Fork 99
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
2 changed files
with
129 additions
and
19 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
## Breadcrumbs | ||
|
||
Breadcrumbs component. Can collapse breadcrumbs that cause overflow. | ||
|
||
### PropTypes | ||
|
||
| Name | Type | Required | Default | Description | | ||
| :----------------------- | :--------- | :------: | :------ | :--------------------------------------------------------------------------------------------------------------------------- | | ||
| items | `Array` | ✓ | | Breadcrumb items array `BreadcrumbsItem[]` | | ||
| className | `String` | | | CSS class name of root element | | ||
| renderRootContent | `Function` | | | Custom render function of first item `(item: BreadcrumbsItem, isCurrent: boolean) => React.ReactNode;`) | | ||
| renderItemContent | `Function` | | | Custom render function of N+1 item `(item: BreadcrumbsItem, isCurrent: boolean, isPrevCurrent: boolean) => React.ReactNode;` | | ||
| renderItemDivider | `Function` | | | Custom render function of items separator `() => React.ReactNode;` | | ||
| lastDisplayedItemsCount | `Enum` | ✓ | | Number of items to display after items collapse control: `LastDisplayedItemsCount` | | ||
| firstDisplayedItemsCount | `Enum` | ✓ | | Number of items to display before items collapse control: `FirstDisplayedItemsCount` | | ||
| popupStyle | `String` | | | Style of collapsed items popup `staircase` | | ||
|
||
### Examples | ||
|
||
```jsx | ||
const breadcrumbs = [ | ||
{ | ||
title: 'What is love', | ||
}, | ||
{ | ||
title: "Baby don't hurt me", | ||
}, | ||
{ | ||
title: "Don't hurt me", | ||
}, | ||
{ | ||
title: 'No more', | ||
}, | ||
]; | ||
|
||
return ( | ||
<Breadcrumbs | ||
items={items} | ||
lastDisplayedItemsCount={LastDisplayedItemsCount.One} | ||
firstDisplayedItemsCount={FirstDisplayedItemsCount.One} | ||
/> | ||
); | ||
``` |
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 |
---|---|---|
@@ -1,43 +1,110 @@ | ||
## Breadcrumbs | ||
<!--GITHUB_BLOCK--> | ||
|
||
Breadcrumbs component. Can collapse breadcrumbs that cause overflow. | ||
# Breadcrumbs | ||
|
||
### PropTypes | ||
<!--/GITHUB_BLOCK--> | ||
|
||
| Name | Type | Required | Default | Description | | ||
| :----------------------- | :--------- | :------: | :------ | :--------------------------------------------------------------------------------------------------------------------------- | | ||
| items | `Array` | ✓ | | Breadcrumb items array `BreadcrumbsItem[]` | | ||
| className | `String` | | | CSS class name of root element | | ||
| renderRootContent | `Function` | | | Custom render function of first item `(item: BreadcrumbsItem, isCurrent: boolean) => React.ReactNode;`) | | ||
| renderItemContent | `Function` | | | Custom render function of N+1 item `(item: BreadcrumbsItem, isCurrent: boolean, isPrevCurrent: boolean) => React.ReactNode;` | | ||
| renderItemDivider | `Function` | | | Custom render function of items separator `() => React.ReactNode;` | | ||
| lastDisplayedItemsCount | `Enum` | ✓ | | Number of items to display after items collapse control: `LastDisplayedItemsCount` | | ||
| firstDisplayedItemsCount | `Enum` | ✓ | | Number of items to display before items collapse control: `FirstDisplayedItemsCount` | | ||
| popupStyle | `String` | | | Style of collapsed items popup `staircase` | | ||
```tsx | ||
import {Breadcrumbs} from '@gravity-ui/uikit'; | ||
``` | ||
|
||
`Breadcrumbs` can collapse breadcrumbs that cause overflow. | ||
|
||
## Appearance | ||
|
||
<!--LANDING_BLOCK | ||
<ExampleBlock | ||
code={` | ||
<Breadcrumbs | ||
items={[ | ||
{ | ||
text: 'Region', | ||
}, | ||
{ | ||
text: 'Country', | ||
}, | ||
{ | ||
text: 'City', | ||
}, | ||
{ | ||
text: 'District', | ||
}, | ||
{ | ||
text: 'Street', | ||
}, | ||
]} | ||
firstDisplayedItemsCount={FirstDisplayedItemsCount.One} | ||
lastDisplayedItemsCount={LastDisplayedItemsCount.One} | ||
/> | ||
`} | ||
> | ||
<UIKit.Breadcrumbs | ||
items={[ | ||
{ | ||
text: 'Region', | ||
}, | ||
{ | ||
text: 'Country', | ||
}, | ||
{ | ||
text: 'City', | ||
}, | ||
{ | ||
text: 'District', | ||
}, | ||
{ | ||
text: 'Street', | ||
}, | ||
]} | ||
firstDisplayedItemsCount={1} | ||
lastDisplayedItemsCount={1} | ||
/> | ||
</ExampleBlock> | ||
LANDING_BLOCK--> | ||
|
||
### Examples | ||
<!--GITHUB_BLOCK--> | ||
|
||
```jsx | ||
const breadcrumbs = [ | ||
{ | ||
title: 'What is love', | ||
text: 'Region', | ||
}, | ||
{ | ||
title: "Baby don't hurt me", | ||
text: 'Country', | ||
}, | ||
{ | ||
title: "Don't hurt me", | ||
text: 'City', | ||
}, | ||
{ | ||
title: 'No more', | ||
text: 'District', | ||
}, | ||
{ | ||
text: 'Street', | ||
}, | ||
]; | ||
|
||
return ( | ||
<Breadcrumbs | ||
items={items} | ||
lastDisplayedItemsCount={LastDisplayedItemsCount.One} | ||
firstDisplayedItemsCount={FirstDisplayedItemsCount.One} | ||
lastDisplayedItemsCount={LastDisplayedItemsCount.One} | ||
/> | ||
); | ||
``` | ||
|
||
<!--/GITHUB_BLOCK--> | ||
|
||
## Properties | ||
|
||
| Name | Description | Type | Default | | ||
| :----------------------- | :--------------------------------------------------------------------------------------------------------------------------- | :--------- | :------ | | ||
| items | Breadcrumb items array `BreadcrumbsItem[]` | `Array` | | | ||
| className | CSS class name of root element | `String` | | | ||
| renderRootContent | Custom render function of first item `(item: BreadcrumbsItem, isCurrent: boolean) => React.ReactNode;`) | `Function` | | | ||
| renderItemContent | Custom render function of N+1 item `(item: BreadcrumbsItem, isCurrent: boolean, isPrevCurrent: boolean) => React.ReactNode;` | `Function` | | | ||
| renderItemDivider | Custom render function of items separator `() => React.ReactNode;` | `Function` | | | ||
| firstDisplayedItemsCount | Number of items to display before items collapse control: `FirstDisplayedItemsCount` | `Enum` | | | ||
| lastDisplayedItemsCount | Number of items to display after items collapse control: `LastDisplayedItemsCount` | `Enum` | | | ||
| popupStyle | Style of collapsed items popup `staircase` | `String` | | |