1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-02-09 00:18:00 +01:00

refactor: use the MUI OutsideClickHandler (#756)

This commit is contained in:
olav 2022-03-01 08:21:04 +01:00 committed by GitHub
parent 43fdb37bd4
commit 2bb069af6b
3 changed files with 7 additions and 92 deletions

View File

@ -53,7 +53,6 @@
"@types/node": "17.0.18", "@types/node": "17.0.18",
"@types/react": "17.0.39", "@types/react": "17.0.39",
"@types/react-dom": "17.0.11", "@types/react-dom": "17.0.11",
"@types/react-outside-click-handler": "1.3.1",
"@types/react-router-dom": "5.3.3", "@types/react-router-dom": "5.3.3",
"@types/react-test-renderer": "17.0.1", "@types/react-test-renderer": "17.0.1",
"@types/react-timeago": "4.1.3", "@types/react-timeago": "4.1.3",
@ -80,7 +79,6 @@
"react-dnd-html5-backend": "14.1.0", "react-dnd-html5-backend": "14.1.0",
"react-dom": "17.0.2", "react-dom": "17.0.2",
"react-hooks-global-state": "1.0.2", "react-hooks-global-state": "1.0.2",
"react-outside-click-handler": "1.3.0",
"react-router-dom": "5.3.0", "react-router-dom": "5.3.0",
"react-scripts": "4.0.3", "react-scripts": "4.0.3",
"react-test-renderer": "17.0.2", "react-test-renderer": "17.0.2",

View File

@ -1,7 +1,6 @@
import React, { useEffect, useState } from 'react'; import React, { useEffect, useState } from 'react';
import classnames from 'classnames'; import classnames from 'classnames';
import OutsideClickHandler from 'react-outside-click-handler'; import { Avatar, Button, ClickAwayListener } from '@material-ui/core';
import { Avatar, Button } from '@material-ui/core';
import KeyboardArrowDownIcon from '@material-ui/icons/KeyboardArrowDown'; import KeyboardArrowDownIcon from '@material-ui/icons/KeyboardArrowDown';
import { useStyles } from './UserProfile.styles'; import { useStyles } from './UserProfile.styles';
import { useCommonStyles } from '../../../common.styles'; import { useCommonStyles } from '../../../common.styles';
@ -57,7 +56,7 @@ const UserProfile = ({
const imageUrl = email ? profile.imageUrl : 'unknown-user.png'; const imageUrl = email ? profile.imageUrl : 'unknown-user.png';
return ( return (
<OutsideClickHandler onOutsideClick={() => setShowProfile(false)}> <ClickAwayListener onClickAway={() => setShowProfile(false)}>
<div className={styles.profileContainer}> <div className={styles.profileContainer}>
<Button <Button
className={classnames( className={classnames(
@ -86,7 +85,7 @@ const UserProfile = ({
currentLocale={currentLocale} currentLocale={currentLocale}
/> />
</div> </div>
</OutsideClickHandler> </ClickAwayListener>
); );
}; };

View File

@ -2147,13 +2147,6 @@
dependencies: dependencies:
"@types/react" "*" "@types/react" "*"
"@types/react-outside-click-handler@1.3.1":
version "1.3.1"
resolved "https://registry.yarnpkg.com/@types/react-outside-click-handler/-/react-outside-click-handler-1.3.1.tgz#e4772ba550e1a548468203194d2615d8f06acdf9"
integrity sha512-0BNan5zIIDyO5k9LFSG+60ZxQ/0wf+LTF9BJx3oOUdOaJlZk6RCe52jRB75mlvLLJx2YLa61+NidOwBfptWMKw==
dependencies:
"@types/react" "*"
"@types/react-router-dom@5.3.3": "@types/react-router-dom@5.3.3":
version "5.3.3" version "5.3.3"
resolved "https://registry.yarnpkg.com/@types/react-router-dom/-/react-router-dom-5.3.3.tgz#e9d6b4a66fcdbd651a5f106c2656a30088cc1e83" resolved "https://registry.yarnpkg.com/@types/react-router-dom/-/react-router-dom-5.3.3.tgz#e9d6b4a66fcdbd651a5f106c2656a30088cc1e83"
@ -2656,21 +2649,6 @@ aggregate-error@^3.0.0:
clean-stack "^2.0.0" clean-stack "^2.0.0"
indent-string "^4.0.0" indent-string "^4.0.0"
airbnb-prop-types@^2.15.0:
version "2.16.0"
resolved "https://registry.npmjs.org/airbnb-prop-types/-/airbnb-prop-types-2.16.0.tgz"
integrity sha512-7WHOFolP/6cS96PhKNrslCLMYAI8yB1Pp6u6XmxozQOiZbsI5ycglZr5cHhBFfuRcQQjzCMith5ZPZdYiJCxUg==
dependencies:
array.prototype.find "^2.1.1"
function.prototype.name "^1.1.2"
is-regex "^1.1.0"
object-is "^1.1.2"
object.assign "^4.1.0"
object.entries "^1.1.2"
prop-types "^15.7.2"
prop-types-exact "^1.2.0"
react-is "^16.13.1"
ajv-errors@^1.0.0: ajv-errors@^1.0.0:
version "1.0.1" version "1.0.1"
resolved "https://registry.npmjs.org/ajv-errors/-/ajv-errors-1.0.1.tgz" resolved "https://registry.npmjs.org/ajv-errors/-/ajv-errors-1.0.1.tgz"
@ -2884,14 +2862,6 @@ array-unique@^0.3.2:
resolved "https://registry.npmjs.org/array-unique/-/array-unique-0.3.2.tgz" resolved "https://registry.npmjs.org/array-unique/-/array-unique-0.3.2.tgz"
integrity sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg= integrity sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg=
array.prototype.find@^2.1.1:
version "2.1.1"
resolved "https://registry.npmjs.org/array.prototype.find/-/array.prototype.find-2.1.1.tgz"
integrity sha512-mi+MYNJYLTx2eNYy+Yh6raoQacCsNeeMUaspFPh9Y141lFSsWxxB8V9mM2ye+eqiRs917J6/pJ4M9ZPzenWckA==
dependencies:
define-properties "^1.1.3"
es-abstract "^1.17.4"
array.prototype.flat@^1.2.3: array.prototype.flat@^1.2.3:
version "1.2.4" version "1.2.4"
resolved "https://registry.npmjs.org/array.prototype.flat/-/array.prototype.flat-1.2.4.tgz" resolved "https://registry.npmjs.org/array.prototype.flat/-/array.prototype.flat-1.2.4.tgz"
@ -4068,11 +4038,6 @@ console-browserify@^1.1.0:
resolved "https://registry.npmjs.org/console-browserify/-/console-browserify-1.2.0.tgz" resolved "https://registry.npmjs.org/console-browserify/-/console-browserify-1.2.0.tgz"
integrity sha512-ZMkYO/LkF17QvCPqM0gxw8yUzigAOZOSWSHg91FH6orS7vcEj5dVZTidN2fQ14yBSdg97RqhSNwLUXInd52OTA== integrity sha512-ZMkYO/LkF17QvCPqM0gxw8yUzigAOZOSWSHg91FH6orS7vcEj5dVZTidN2fQ14yBSdg97RqhSNwLUXInd52OTA==
"consolidated-events@^1.1.1 || ^2.0.0":
version "2.0.2"
resolved "https://registry.npmjs.org/consolidated-events/-/consolidated-events-2.0.2.tgz"
integrity sha512-2/uRVMdRypf5z/TW/ncD/66l75P5hH2vM/GR8Jf8HLc2xnfJtmina6F6du8+v4Z2vTrMo7jC+W1tmEEuuELgkQ==
constants-browserify@^1.0.0: constants-browserify@^1.0.0:
version "1.0.0" version "1.0.0"
resolved "https://registry.npmjs.org/constants-browserify/-/constants-browserify-1.0.0.tgz" resolved "https://registry.npmjs.org/constants-browserify/-/constants-browserify-1.0.0.tgz"
@ -4877,13 +4842,6 @@ doctrine@^3.0.0:
dependencies: dependencies:
esutils "^2.0.2" esutils "^2.0.2"
document.contains@^1.0.1:
version "1.0.2"
resolved "https://registry.npmjs.org/document.contains/-/document.contains-1.0.2.tgz"
integrity sha512-YcvYFs15mX8m3AO1QNQy3BlIpSMfNRj3Ujk2BEJxsZG+HZf7/hZ6jr7mDpXrF8q+ff95Vef5yjhiZxm8CGJr6Q==
dependencies:
define-properties "^1.1.3"
dom-accessibility-api@^0.5.6: dom-accessibility-api@^0.5.6:
version "0.5.7" version "0.5.7"
resolved "https://registry.npmjs.org/dom-accessibility-api/-/dom-accessibility-api-0.5.7.tgz" resolved "https://registry.npmjs.org/dom-accessibility-api/-/dom-accessibility-api-0.5.7.tgz"
@ -5119,7 +5077,7 @@ error-stack-parser@^2.0.6:
dependencies: dependencies:
stackframe "^1.1.1" stackframe "^1.1.1"
es-abstract@^1.17.2, es-abstract@^1.17.4, es-abstract@^1.18.0-next.1, es-abstract@^1.18.0-next.2: es-abstract@^1.17.2, es-abstract@^1.18.0-next.1, es-abstract@^1.18.0-next.2:
version "1.18.0" version "1.18.0"
resolved "https://registry.npmjs.org/es-abstract/-/es-abstract-1.18.0.tgz" resolved "https://registry.npmjs.org/es-abstract/-/es-abstract-1.18.0.tgz"
integrity sha512-LJzK7MrQa8TS0ja2w3YNLzUgJCGPdPOV1yVvezjNnS89D+VR08+Szt2mz3YB2Dck/+w5tfIq/RoUAFqJJGM2yw== integrity sha512-LJzK7MrQa8TS0ja2w3YNLzUgJCGPdPOV1yVvezjNnS89D+VR08+Szt2mz3YB2Dck/+w5tfIq/RoUAFqJJGM2yw==
@ -5978,26 +5936,11 @@ function-bind@^1.1.1:
resolved "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz" resolved "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz"
integrity sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A== integrity sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==
function.prototype.name@^1.1.2:
version "1.1.4"
resolved "https://registry.npmjs.org/function.prototype.name/-/function.prototype.name-1.1.4.tgz"
integrity sha512-iqy1pIotY/RmhdFZygSSlW0wko2yxkSCKqsuv4pr8QESohpYyG/Z7B/XXvPRKTJS//960rgguE5mSRUsDdaJrQ==
dependencies:
call-bind "^1.0.2"
define-properties "^1.1.3"
es-abstract "^1.18.0-next.2"
functions-have-names "^1.2.2"
functional-red-black-tree@^1.0.1: functional-red-black-tree@^1.0.1:
version "1.0.1" version "1.0.1"
resolved "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz" resolved "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz"
integrity sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc= integrity sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=
functions-have-names@^1.2.2:
version "1.2.2"
resolved "https://registry.npmjs.org/functions-have-names/-/functions-have-names-1.2.2.tgz"
integrity sha512-bLgc3asbWdwPbx2mNk2S49kmJCuQeu0nfmaOgbs8WIyzzkw3r4htszdIi9Q9EMezDPTYuJx2wvjZ/EwgAthpnA==
gensync@^1.0.0-beta.1, gensync@^1.0.0-beta.2: gensync@^1.0.0-beta.1, gensync@^1.0.0-beta.2:
version "1.0.0-beta.2" version "1.0.0-beta.2"
resolved "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz" resolved "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz"
@ -7008,7 +6951,7 @@ is-potential-custom-element-name@^1.0.0:
resolved "https://registry.npmjs.org/is-potential-custom-element-name/-/is-potential-custom-element-name-1.0.0.tgz" resolved "https://registry.npmjs.org/is-potential-custom-element-name/-/is-potential-custom-element-name-1.0.0.tgz"
integrity sha1-DFLlS8yjkbssSUsh6GJtczbG45c= integrity sha1-DFLlS8yjkbssSUsh6GJtczbG45c=
is-regex@^1.0.4, is-regex@^1.1.0, is-regex@^1.1.2: is-regex@^1.0.4, is-regex@^1.1.2:
version "1.1.2" version "1.1.2"
resolved "https://registry.npmjs.org/is-regex/-/is-regex-1.1.2.tgz" resolved "https://registry.npmjs.org/is-regex/-/is-regex-1.1.2.tgz"
integrity sha512-axvdhb5pdhEVThqJzYXwMlVuZwC+FF2DpcOhTS+y/8jVq4trxyPgfcwIxIKiyeuLlSQYKkmUaPQJ8ZE4yNKXDg== integrity sha512-axvdhb5pdhEVThqJzYXwMlVuZwC+FF2DpcOhTS+y/8jVq4trxyPgfcwIxIKiyeuLlSQYKkmUaPQJ8ZE4yNKXDg==
@ -8708,7 +8651,7 @@ object-inspect@^1.9.0:
resolved "https://registry.npmjs.org/object-inspect/-/object-inspect-1.9.0.tgz" resolved "https://registry.npmjs.org/object-inspect/-/object-inspect-1.9.0.tgz"
integrity sha512-i3Bp9iTqwhaLZBxGkRfo5ZbE07BQRT7MGu8+nNgwW9ItGp1TzCTw2DLEoWwjClxBjOFI/hWljTAmYGCEwmtnOw== integrity sha512-i3Bp9iTqwhaLZBxGkRfo5ZbE07BQRT7MGu8+nNgwW9ItGp1TzCTw2DLEoWwjClxBjOFI/hWljTAmYGCEwmtnOw==
object-is@^1.0.1, object-is@^1.1.2: object-is@^1.0.1:
version "1.1.5" version "1.1.5"
resolved "https://registry.npmjs.org/object-is/-/object-is-1.1.5.tgz" resolved "https://registry.npmjs.org/object-is/-/object-is-1.1.5.tgz"
integrity sha512-3cyDsyHgtmi7I7DfSSI2LDp6SK2lwvtbg0p0R1e0RvTqF5ceGx+K2dfSjm1bKDMVCFEDAQvy+o8c6a7VujOddw== integrity sha512-3cyDsyHgtmi7I7DfSSI2LDp6SK2lwvtbg0p0R1e0RvTqF5ceGx+K2dfSjm1bKDMVCFEDAQvy+o8c6a7VujOddw==
@ -8738,7 +8681,7 @@ object.assign@^4.1.0, object.assign@^4.1.2:
has-symbols "^1.0.1" has-symbols "^1.0.1"
object-keys "^1.1.1" object-keys "^1.1.1"
object.entries@^1.1.0, object.entries@^1.1.2, object.entries@^1.1.3: object.entries@^1.1.0, object.entries@^1.1.3:
version "1.1.3" version "1.1.3"
resolved "https://registry.npmjs.org/object.entries/-/object.entries-1.1.3.tgz" resolved "https://registry.npmjs.org/object.entries/-/object.entries-1.1.3.tgz"
integrity sha512-ym7h7OZebNS96hn5IJeyUmaWhaSM4SVtAPPfNLQEI2MYWCO2egsITb9nab2+i/Pwibx+R0mtn+ltKJXRSeTMGg== integrity sha512-ym7h7OZebNS96hn5IJeyUmaWhaSM4SVtAPPfNLQEI2MYWCO2egsITb9nab2+i/Pwibx+R0mtn+ltKJXRSeTMGg==
@ -10049,15 +9992,6 @@ prompts@^2.0.1:
kleur "^3.0.3" kleur "^3.0.3"
sisteransi "^1.0.5" sisteransi "^1.0.5"
prop-types-exact@^1.2.0:
version "1.2.0"
resolved "https://registry.npmjs.org/prop-types-exact/-/prop-types-exact-1.2.0.tgz"
integrity sha512-K+Tk3Kd9V0odiXFP9fwDHUYRyvK3Nun3GVyPapSIs5OBkITAm15W0CPFD/YKTkMUAbc0b9CUwRQp2ybiBIq+eA==
dependencies:
has "^1.0.3"
object.assign "^4.1.0"
reflect.ownkeys "^0.2.0"
prop-types@15.8.1: prop-types@15.8.1:
version "15.8.1" version "15.8.1"
resolved "https://registry.yarnpkg.com/prop-types/-/prop-types-15.8.1.tgz#67d87bf1a694f48435cf332c24af10214a3140b5" resolved "https://registry.yarnpkg.com/prop-types/-/prop-types-15.8.1.tgz#67d87bf1a694f48435cf332c24af10214a3140b5"
@ -10330,17 +10264,6 @@ react-is@^16.13.1, react-is@^16.6.0, react-is@^16.7.0, react-is@^16.8.1:
resolved "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz" resolved "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz"
integrity sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ== integrity sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==
react-outside-click-handler@1.3.0:
version "1.3.0"
resolved "https://registry.npmjs.org/react-outside-click-handler/-/react-outside-click-handler-1.3.0.tgz"
integrity sha512-Te/7zFU0oHpAnctl//pP3hEAeobfeHMyygHB8MnjP6sX5OR8KHT1G3jmLsV3U9RnIYo+Yn+peJYWu+D5tUS8qQ==
dependencies:
airbnb-prop-types "^2.15.0"
consolidated-events "^1.1.1 || ^2.0.0"
document.contains "^1.0.1"
object.values "^1.1.0"
prop-types "^15.7.2"
react-refresh@^0.8.3: react-refresh@^0.8.3:
version "0.8.3" version "0.8.3"
resolved "https://registry.npmjs.org/react-refresh/-/react-refresh-0.8.3.tgz" resolved "https://registry.npmjs.org/react-refresh/-/react-refresh-0.8.3.tgz"
@ -10585,11 +10508,6 @@ redux@^4.1.1:
dependencies: dependencies:
"@babel/runtime" "^7.9.2" "@babel/runtime" "^7.9.2"
reflect.ownkeys@^0.2.0:
version "0.2.0"
resolved "https://registry.npmjs.org/reflect.ownkeys/-/reflect.ownkeys-0.2.0.tgz"
integrity sha1-dJrO7H8/34tj+SegSAnpDFwLNGA=
regenerate-unicode-properties@^8.2.0: regenerate-unicode-properties@^8.2.0:
version "8.2.0" version "8.2.0"
resolved "https://registry.npmjs.org/regenerate-unicode-properties/-/regenerate-unicode-properties-8.2.0.tgz" resolved "https://registry.npmjs.org/regenerate-unicode-properties/-/regenerate-unicode-properties-8.2.0.tgz"