Skip to content
This repository was archived by the owner on Jan 9, 2023. It is now read-only.

Commit f6e5be5

Browse files
committed
feat(breadcrumb): separate breadcrumb item component
1 parent 8f59804 commit f6e5be5

3 files changed

Lines changed: 53 additions & 30 deletions

File tree

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import React, { ElementType } from 'react'
2+
import BootstrapBreadcrumb from 'react-bootstrap/Breadcrumb'
3+
4+
interface Props {
5+
as?: ElementType
6+
label?: string
7+
/** Defines the attributes of the children items */
8+
itemProps?: {
9+
as?: ElementType
10+
href?: string
11+
active?: boolean
12+
target?: string
13+
title?: string
14+
}
15+
/** see https://react-bootstrap.github.io/components/breadcrumb/ */
16+
listProps?: {}
17+
/** The children to render */
18+
children?: React.ReactNode
19+
}
20+
const Breadcrumb = (props: Props) => {
21+
const { as, label, listProps, children } = props
22+
23+
return (
24+
<BootstrapBreadcrumb as={as} label={label} listProps={listProps}>
25+
{children}
26+
</BootstrapBreadcrumb>
27+
)
28+
}
29+
30+
export { Breadcrumb }
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import React, { ElementType } from 'react'
2+
import BootstrapBreadcrumbItem from 'react-bootstrap/BreadcrumbItem'
3+
4+
interface Props {
5+
/** Defines the attributes of the children items */
6+
itemProps?: {
7+
as?: ElementType
8+
href?: string
9+
active?: boolean
10+
target?: string
11+
title?: string
12+
}
13+
/** The children to render */
14+
children?: React.ReactNode
15+
}
16+
const BreadcrumbItem = ({ children, itemProps }: Props) => (
17+
// eslint-disable-next-line react/jsx-props-no-multi-spaces
18+
<BootstrapBreadcrumbItem {...itemProps}>{children}</BootstrapBreadcrumbItem>
19+
)
20+
21+
export { BreadcrumbItem }
Lines changed: 2 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,2 @@
1-
import React, { ElementType } from 'react'
2-
import BootstrapBreadcrumb from 'react-bootstrap/Breadcrumb'
3-
import BreadcrumbItem from 'react-bootstrap/BreadcrumbItem'
4-
5-
interface Props {
6-
as?: ElementType
7-
label?: string
8-
/** Defines the attributes of the children items */
9-
breadcrumbItemProps?: {
10-
as?: ElementType
11-
href?: string
12-
active?: boolean
13-
target?: string
14-
title?: string
15-
}
16-
listProps?: {}
17-
/** The children to render */
18-
children?: React.ReactNode
19-
}
20-
const Breadcrumb = (props: Props) => {
21-
const { as, label, listProps, breadcrumbItemProps } = props
22-
23-
return (
24-
<BootstrapBreadcrumb as={as} label={label} listProps={listProps}>
25-
<BreadcrumbItem {...breadcrumbItemProps} />
26-
</BootstrapBreadcrumb>
27-
)
28-
}
29-
30-
export { Breadcrumb }
1+
export * from './Breadcrumb'
2+
export * from './BreadcrumbItem'

0 commit comments

Comments
 (0)