From 65a350cc1f0f3ea8f30a6996dd76a095326aa6b3 Mon Sep 17 00:00:00 2001 From: Innocente Agostinelli Date: Sat, 9 Jul 2016 14:06:08 -0400 Subject: [PATCH 1/2] Challenge Done --- src/components/ControlledInputList/index.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/components/ControlledInputList/index.js b/src/components/ControlledInputList/index.js index 16b35f2..84a6035 100644 --- a/src/components/ControlledInputList/index.js +++ b/src/components/ControlledInputList/index.js @@ -178,7 +178,8 @@ var MundoTitle = connectToState(Title, (state, props) => { class ClearButton extends React.Component { clearAllValues() { - // ... + var newValues = state.values.map(value => value = '') + setState({values:newValues}); } render() { @@ -192,8 +193,15 @@ class ClearButton extends React.Component { } var ConnectedClearButton = connectToState(ClearButton, (state) => { + var valor = false; + console.log(valor) + state.values.forEach(value =>{ + if( value == ''){ + valor = true; + } + }); return { - // ... ? + disabled: valor }; }); From 363de2d0019bfafb0e2a1ca4c43557cf35bac24e Mon Sep 17 00:00:00 2001 From: Innocente Agostinelli Date: Sat, 9 Jul 2016 14:16:06 -0400 Subject: [PATCH 2/2] Fixed Clear Button --- src/components/ControlledInputList/index.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/components/ControlledInputList/index.js b/src/components/ControlledInputList/index.js index 84a6035..f3572cf 100644 --- a/src/components/ControlledInputList/index.js +++ b/src/components/ControlledInputList/index.js @@ -194,9 +194,12 @@ class ClearButton extends React.Component { var ConnectedClearButton = connectToState(ClearButton, (state) => { var valor = false; - console.log(valor) + var count = 0; state.values.forEach(value =>{ if( value == ''){ + count++; + } + if (count == (state.values.length)){ valor = true; } });