@@ -37,10 +65,10 @@ export const EuiSideNavItem = ({
href,
items,
children,
- depth,
- renderItem = defaultRenderItem,
+ depth = 0,
+ renderItem: RenderItem = DefaultRenderItem,
...rest
-}) => {
+}: EuiSideNavItemProps) => {
let childItems;
if (items && isOpen) {
@@ -87,27 +115,15 @@ export const EuiSideNavItem = ({
return (
- {renderItem({
- href,
- onClick,
- className: buttonClasses,
- children: buttonContent,
- ...rest,
- })}
+
+ {buttonContent}
+
+
{childItems}
);
};
-
-EuiSideNavItem.propTypes = {
- isOpen: PropTypes.bool,
- isSelected: PropTypes.bool,
- isParent: PropTypes.bool,
- icon: PropTypes.node,
- onClick: PropTypes.func,
- href: PropTypes.string,
- items: PropTypes.node,
- children: PropTypes.node,
- depth: PropTypes.number,
- renderItem: PropTypes.func,
-};
From 3eb20afc596c939c63ddc05ef92f978efd8d577b Mon Sep 17 00:00:00 2001
From: Rafal Lesniak
Date: Mon, 3 Feb 2020 20:05:24 +0100
Subject: [PATCH 2/7] up changelog
---
CHANGELOG.md | 1 +
1 file changed, 1 insertion(+)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 0b64116b287..838896d6b2a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,6 +5,7 @@
- Changed SASS comments to non-compiled comments in invisibles files ([#2807](https://github.com/elastic/eui/pull/2807))
- Added `rowHeader` prop to `EuiBasicTable` to allow consumers to set the identifying cell in a row ([#2802](https://github.com/elastic/eui/pull/2802))
- Improved `EuiDescribedFormGroup` accessibility by avoiding duplicated output in screen readers ([#2783](https://github.com/elastic/eui/pull/2783))
+- Converted `EuiSideNav` to TypeScript ([#2659](https://github.com/elastic/eui/issues/2659))
**Bug fixes**
From 2dedb95d3b9c465673e5abe1fbc6199adcfd2646 Mon Sep 17 00:00:00 2001
From: Rafal Lesniak
Date: Tue, 4 Feb 2020 20:38:29 +0100
Subject: [PATCH 3/7] PR updates
---
CHANGELOG.md | 2 +-
src-docs/src/views/side_nav/props.tsx | 5 ++
.../src/views/side_nav/side_nav_example.js | 4 +-
src/components/side_nav/index.ts | 2 +
src/components/side_nav/side_nav.test.tsx | 6 +-
src/components/side_nav/side_nav.tsx | 67 ++++---------------
src/components/side_nav/side_nav_item.tsx | 6 +-
src/components/side_nav/side_nav_types.ts | 42 ++++++++++++
8 files changed, 72 insertions(+), 62 deletions(-)
create mode 100644 src-docs/src/views/side_nav/props.tsx
create mode 100644 src/components/side_nav/side_nav_types.ts
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 838896d6b2a..f65aa2e188a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,7 +5,7 @@
- Changed SASS comments to non-compiled comments in invisibles files ([#2807](https://github.com/elastic/eui/pull/2807))
- Added `rowHeader` prop to `EuiBasicTable` to allow consumers to set the identifying cell in a row ([#2802](https://github.com/elastic/eui/pull/2802))
- Improved `EuiDescribedFormGroup` accessibility by avoiding duplicated output in screen readers ([#2783](https://github.com/elastic/eui/pull/2783))
-- Converted `EuiSideNav` to TypeScript ([#2659](https://github.com/elastic/eui/issues/2659))
+- Converted `EuiSideNav` to TypeScript ([#2818](https://github.com/elastic/eui/issues/2818))
**Bug fixes**
diff --git a/src-docs/src/views/side_nav/props.tsx b/src-docs/src/views/side_nav/props.tsx
new file mode 100644
index 00000000000..45511337092
--- /dev/null
+++ b/src-docs/src/views/side_nav/props.tsx
@@ -0,0 +1,5 @@
+import React, { FunctionComponent } from 'react';
+import { EuiSideNavItemType } from '../../../../src/components/side_nav/side_nav_types';
+// import { EuiDataGridColumn } from '../../../../src/components/datagrid/data_grid_types';
+
+export const SideNavItem: FunctionComponent = () => ;
diff --git a/src-docs/src/views/side_nav/side_nav_example.js b/src-docs/src/views/side_nav/side_nav_example.js
index 3c677bebefd..3665c350ce6 100644
--- a/src-docs/src/views/side_nav/side_nav_example.js
+++ b/src-docs/src/views/side_nav/side_nav_example.js
@@ -18,6 +18,8 @@ import SideNavForceOpen from './side_nav_force_open';
const sideNavForceOpenSource = require('!!raw-loader!./side_nav_force_open');
const sideNavForceOpenHtml = renderToHtml(SideNavForceOpen);
+import { SideNavItem } from './props';
+
export const SideNavExample = {
title: 'Side Nav',
sections: [
@@ -48,7 +50,7 @@ export const SideNavExample = {