From a0565f79d22c1505732c58815c9b51db53e6dde0 Mon Sep 17 00:00:00 2001 From: KevinMidboe Date: Sat, 21 Oct 2017 09:48:13 +0200 Subject: [PATCH] Changed name of variable element to requestElement and now the link name of a list item is generated by generateListElements and if this element is the one selected make it visually different --- client/app/components/admin/Sidebar.jsx | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/client/app/components/admin/Sidebar.jsx b/client/app/components/admin/Sidebar.jsx index 09dc4ab..5d001b0 100644 --- a/client/app/components/admin/Sidebar.jsx +++ b/client/app/components/admin/Sidebar.jsx @@ -3,12 +3,23 @@ import { Link } from 'react-router-dom'; class SidebarComponent extends Component { + generateListElements(index, item) { + if (index == this.props.listItemSelected) + return ( + {item.name} + ) + else + return ( + {item.name} + ) + } + displayRequestedElementsInfo() { if (this.props.requested_objects) { - let element = this.props.requested_objects.map((item, index) => { + let requestedElement = this.props.requested_objects.map((item, index) => { return ( - {item.name} + { this.generateListElements(index, item) } {item.status} {item.requested_date} @@ -25,7 +36,7 @@ class SidebarComponent extends Component { - {element} + {requestedElement} )