From 4a61df0f8c752e5f07ad0a2dc57d2c8369aff2ef Mon Sep 17 00:00:00 2001 From: Martin Ohlson Date: Fri, 10 Jul 2020 14:33:57 +0200 Subject: [PATCH] fix: add prop selected to renderOption --- packages/widgets/src/Transfer/Transfer.js | 2 ++ packages/widgets/src/Transfer/Transfer.stories.js | 14 ++++++++++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/packages/widgets/src/Transfer/Transfer.js b/packages/widgets/src/Transfer/Transfer.js index 984dc4ebca..0a4b71d90f 100644 --- a/packages/widgets/src/Transfer/Transfer.js +++ b/packages/widgets/src/Transfer/Transfer.js @@ -218,6 +218,7 @@ export const Transfer = ({ toggleHighlightedSourceOption ), highlighted, + selected: false, })} ) @@ -314,6 +315,7 @@ export const Transfer = ({ toggleHighlightedPickedOption ), highlighted, + selected: true, })} ) diff --git a/packages/widgets/src/Transfer/Transfer.stories.js b/packages/widgets/src/Transfer/Transfer.stories.js index 2c3c02f0c8..7db8c88add 100644 --- a/packages/widgets/src/Transfer/Transfer.stories.js +++ b/packages/widgets/src/Transfer/Transfer.stories.js @@ -176,10 +176,13 @@ export const Filtered = () => ( ) -const renderOption = ({ label, value, onClick, highlighted }) => ( +const renderOption = ({ label, value, onClick, highlighted, selected }) => (

onClick({ label, value }, event)} - style={{ background: highlighted ? 'green' : 'blue' }} + style={{ + background: highlighted ? 'green' : 'blue', + color: selected ? 'orange' : 'white', + }} > Custom: {label} (label), {value} (value)

@@ -189,10 +192,13 @@ export const CustomListOptions = () => ( <> Custom option code: -
{`const renderOption = ({ label, value, onClick, highlighted }) => (
+            
{`const renderOption = ({ label, value, onClick, highlighted, selected }) => (
     

onClick({ label, value }, event)} - style={{ background: highlighted ? 'green' : 'blue' }} + style={{ + background: highlighted ? 'green' : 'blue', + color: selected ? 'orange' : 'white', + }} > Custom: {label} (label), {value} (value)