From b5874c1428d9445921db242b248798adbf7b4b9d Mon Sep 17 00:00:00 2001 From: kibigo! Date: Sat, 6 Jan 2018 15:34:01 -0800 Subject: Fixes to search dropdown --- .../glitch/features/drawer/search/index.js | 11 +-- .../glitch/features/drawer/search/popout/index.js | 99 ++++++++++++---------- 2 files changed, 58 insertions(+), 52 deletions(-) (limited to 'app/javascript/flavours/glitch/features') diff --git a/app/javascript/flavours/glitch/features/drawer/search/index.js b/app/javascript/flavours/glitch/features/drawer/search/index.js index 2d739349c..8cbb0906c 100644 --- a/app/javascript/flavours/glitch/features/drawer/search/index.js +++ b/app/javascript/flavours/glitch/features/drawer/search/index.js @@ -45,10 +45,10 @@ const handlers = { const { onClear, submitted, - value: { length }, + value, } = this.props; e.preventDefault(); // Prevents focus change ?? - if (onClear && (submitted || length)) { + if (onClear && (submitted || value && value.length)) { onClear(); } }, @@ -100,7 +100,8 @@ export default class DrawerSearch extends React.PureComponent { value, } = this.props; const { expanded } = this.state; - const computedClass = classNames('drawer--search', { active: value.length || submitted }); + const active = value && value.length || submitted; + const computedClass = classNames('drawer--search', { active }); return (
@@ -126,11 +127,11 @@ export default class DrawerSearch extends React.PureComponent { tabIndex='0' > - +
diff --git a/app/javascript/flavours/glitch/features/drawer/search/popout/index.js b/app/javascript/flavours/glitch/features/drawer/search/popout/index.js index b5ea86ff1..6219f46ca 100644 --- a/app/javascript/flavours/glitch/features/drawer/search/popout/index.js +++ b/app/javascript/flavours/glitch/features/drawer/search/popout/index.js @@ -42,56 +42,61 @@ export default function DrawerSearchPopout ({ style }) { // The result. return ( - - {({ opacity, scaleX, scaleY }) => ( -
-

-
    -
  • - #example - {' '} - -
  • -
  • - @username@domain - {' '} - -
  • -
  • - URL - {' '} - -
  • -
  • - URL - {' '} - -
  • -
- -
- )} -
+ + {({ opacity, scaleX, scaleY }) => ( +
+

+
    +
  • + #example + {' '} + +
  • +
  • + @username@domain + {' '} + +
  • +
  • + URL + {' '} + +
  • +
  • + URL + {' '} + +
  • +
+ +
+ )} +
+ ); } -- cgit