From 79b14bd62bb795081d366b8c6f357eab4ea131df Mon Sep 17 00:00:00 2001 From: Robbie Antenesse Date: Fri, 22 Dec 2017 12:35:50 -0700 Subject: [PATCH] Add a notification for when a search filter is being used --- src/components/MainDisplay.jsx | 16 +++++++++++++++- src/index.jsx | 12 +++++++++--- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/src/components/MainDisplay.jsx b/src/components/MainDisplay.jsx index fb3347f..c4b253c 100644 --- a/src/components/MainDisplay.jsx +++ b/src/components/MainDisplay.jsx @@ -16,6 +16,7 @@ export class MainDisplay extends Component { PropTypes.checkPropTypes({ dictionaryInfo: PropTypes.object.isRequired, wordsToDisplay: PropTypes.array.isRequired, + wordsAreFiltered: PropTypes.bool, updateDisplay: PropTypes.func.isRequired, updater: PropTypes.object.isRequired, }, props, 'prop', 'MainDisplay'); @@ -47,7 +48,13 @@ export class MainDisplay extends Component { } render () { - const { dictionaryInfo, wordsToDisplay, updateDisplay, updater } = this.props; + const { + dictionaryInfo, + wordsToDisplay, + wordsAreFiltered, + updateDisplay, + updater, + } = this.props; const { isMobile, wordFormIsOpen } = this.state; const wordFormIsDisabled = dictionaryInfo.settings.isComplete; @@ -82,6 +89,13 @@ export class MainDisplay extends Component { updateDisplay={ updateDisplay } /> + {wordsAreFiltered + && ( +
+ Words are filtered—displaying {wordsToDisplay.length} word{wordsToDisplay.length !== 1 && 's'} +
+ )} + { const wordPartOfSpeech = word.partOfSpeech === '' ? 'Uncategorized' : word.partOfSpeech; if (!filteredPartsOfSpeech.includes(wordPartOfSpeech)) { @@ -180,6 +185,7 @@ class App extends Component {