Skip to content

Commit

Permalink
docs(Breadcrumbs): add readme
Browse files Browse the repository at this point in the history
  • Loading branch information
Feverqwe committed Sep 8, 2023
1 parent bccc417 commit e3ef64e
Show file tree
Hide file tree
Showing 2 changed files with 129 additions and 19 deletions.
43 changes: 43 additions & 0 deletions src/components/Breadcrumbs/README.OLD.md
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}
/>
);
```
105 changes: 86 additions & 19 deletions src/components/Breadcrumbs/README.md
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` | |

0 comments on commit e3ef64e

Please sign in to comment.