From 185968104aab4a90acd91f2f6cb2685567d7f6ed Mon Sep 17 00:00:00 2001 From: arkwright <1445684+arkwright@users.noreply.github.com> Date: Wed, 14 Mar 2018 13:21:20 -0400 Subject: [PATCH] Add ability to force open EuiSideNav items. --- CHANGELOG.md | 1 + src-docs/src/views/side_nav/side_nav.js | 2 +- .../src/views/side_nav/side_nav_example.js | 23 +- .../src/views/side_nav/side_nav_force_open.js | 94 +++++++ .../__snapshots__/side_nav.test.js.snap | 164 +++++++++++- src/components/side_nav/_side_nav_item.scss | 14 +- src/components/side_nav/side_nav.js | 39 +++ src/components/side_nav/side_nav.test.js | 248 ++++++++++-------- src/components/side_nav/side_nav_item.js | 3 +- 9 files changed, 456 insertions(+), 132 deletions(-) create mode 100644 src-docs/src/views/side_nav/side_nav_force_open.js diff --git a/CHANGELOG.md b/CHANGELOG.md index 4a77e853ceb1..1933a3a3ac29 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ No public interface changes since `0.0.27`. - New icons for `logoGithub` and `logoSketch` ([#494](https://github.com/elastic/eui/pull/494)) - `EuiCard` now has an `href` and `isClickable` prop for better handling hover animations. ([#494](https://github.com/elastic/eui/pull/494)) - Added `calculateContrast` and `rgbToHex` to services ([#494](https://github.com/elastic/eui/pull/494)) +- Add ability to force `EuiSideNav` items open by setting `item.forceOpen`. ([#497](https://github.com/elastic/eui/pull/515)) **Bug fixes** diff --git a/src-docs/src/views/side_nav/side_nav.js b/src-docs/src/views/side_nav/side_nav.js index 902b21743836..fce8d11ff5ce 100644 --- a/src-docs/src/views/side_nav/side_nav.js +++ b/src-docs/src/views/side_nav/side_nav.js @@ -37,7 +37,7 @@ export default class extends Component { name: 'Saved Objects', id: 3, onClick: () => { window.alert('Saved Objects'); }, - isSelected: true, + isSelected: false, }, { name: 'Reporting', id: 4, 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 0496fb5949ac..bbf1e3599a1d 100644 --- a/src-docs/src/views/side_nav/side_nav_example.js +++ b/src-docs/src/views/side_nav/side_nav_example.js @@ -19,6 +19,10 @@ import SideNavComplex from './side_nav_complex'; const sideNavComplexSource = require('!!raw-loader!./side_nav_complex'); const sideNavComplexHtml = renderToHtml(SideNavComplex); +import SideNavForceOpen from './side_nav_force_open'; +const sideNavForceOpenSource = require('!!raw-loader!./side_nav_force_open'); +const sideNavForceOpenHtml = renderToHtml(SideNavForceOpen); + export const SideNavExample = { title: 'Side Nav', sections: [{ @@ -34,12 +38,12 @@ export const SideNavExample = {
Configure the content of a
+