@zendeskgarden/container-breadcrumb
Version:
Containers relating to breadcrumb in the Garden Design System
43 lines (38 loc) • 956 B
JavaScript
/**
* Copyright Zendesk, Inc.
*
* Use of this source code is governed under the Apache License, Version 2.0
* found at http://www.apache.org/licenses/LICENSE-2.0.
*/
import React from 'react';
import PropTypes from 'prop-types';
const useBreadcrumb = () => ({
getContainerProps: _ref => {
let {
role = 'navigation',
...other
} = _ref;
return {
role: role === null ? undefined : role,
'data-garden-container-id': 'containers.breadcrumb',
'data-garden-container-version': '1.0.10',
...other
};
},
getCurrentPageProps: props => ({
'aria-current': 'page',
...props
})
});
const BreadcrumbContainer = _ref => {
let {
children,
render = children
} = _ref;
return React.createElement(React.Fragment, null, render(useBreadcrumb()));
};
BreadcrumbContainer.propTypes = {
render: PropTypes.func,
children: PropTypes.func
};
export { BreadcrumbContainer, useBreadcrumb };