From 49f4505a5ca2f0ce210a2ff8bdc0dd68799ce61a Mon Sep 17 00:00:00 2001 From: Maina Wycliffe Date: Wed, 20 Sep 2023 22:51:48 +0300 Subject: [PATCH] fix: transition as breaking modal scrolls and sizing --- .eslintrc.js | 7 +- .../Kratos/KratosUserProfileDropdown.tsx | 2 + src/components/CollapsiblePanel/index.tsx | 6 +- src/components/Dropdown/SubtleDropdown.tsx | 2 +- src/components/Dropdown/index.tsx | 120 +++++++++--------- src/components/DropdownMenu/index.tsx | 2 + src/components/Menu/index.tsx | 3 +- src/components/Modal/index.tsx | 2 + src/components/QueryBuilder/index.tsx | 2 + src/components/RefreshDropdown/index.tsx | 1 + 10 files changed, 84 insertions(+), 63 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 1b0062ccf..a3cdeef00 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -7,7 +7,12 @@ module.exports = { node: true, mocha: true }, - extends: ["react-app", "react-app/jest", "plugin:storybook/recommended", "plugin:jest-dom/recommended",], + extends: [ + "react-app", + "react-app/jest", + "plugin:storybook/recommended", + "plugin:jest-dom/recommended" + ], rules: { "react/function-component-definition": [ 2, diff --git a/src/components/Authentication/Kratos/KratosUserProfileDropdown.tsx b/src/components/Authentication/Kratos/KratosUserProfileDropdown.tsx index 0cc8f2796..73794c734 100644 --- a/src/components/Authentication/Kratos/KratosUserProfileDropdown.tsx +++ b/src/components/Authentication/Kratos/KratosUserProfileDropdown.tsx @@ -4,6 +4,7 @@ import { useUser } from "../../../context"; import { ClickableSvg } from "../../ClickableSvg/ClickableSvg"; import { VersionInfo } from "../../VersionInfo/VersionInfo"; import KratosLogoutButton from "./KratosLogoutButton"; +import { Fragment } from "react"; export function KratosUserProfileDropdown() { const { user } = useUser(); @@ -29,6 +30,7 @@ export function KratosUserProfileDropdown() { {/* @ts-ignore */} - {/* @ts-expect-error */} + + {/* @ts-ignore */} - - {Object.values(items) - .sort((a, b) => { - if ( - Object.prototype.hasOwnProperty.call(a, "order") && - Object.prototype.hasOwnProperty.call(b, "order") - ) { - return a.order - b.order; - } - if (Object.prototype.hasOwnProperty.call(a, "order")) { - return -1; - } - if (Object.prototype.hasOwnProperty.call(b, "order")) { - return 1; - } - return 0; - }) - .map((item) => ( - - clsx( - active ? "text-white bg-blue-600" : "text-gray-900", - "cursor-pointer select-none relative py-2 pl-3 pr-9" - ) + {/* eslint-disable-next-line react/jsx-no-useless-fragment */} + <> + + {Object.values(items) + .sort((a, b) => { + if ( + Object.prototype.hasOwnProperty.call(a, "order") && + Object.prototype.hasOwnProperty.call(b, "order") + ) { + return a.order - b.order; } - value={item.value} - > - {({ selected, active }) => ( - <> -
-
{item.icon}
- - {item.description} - -
+ if (Object.prototype.hasOwnProperty.call(a, "order")) { + return -1; + } + if (Object.prototype.hasOwnProperty.call(b, "order")) { + return 1; + } + return 0; + }) + .map((item) => ( + + clsx( + active ? "text-white bg-blue-600" : "text-gray-900", + "cursor-pointer select-none relative py-2 pl-3 pr-9" + ) + } + value={item.value} + > + {({ selected, active }) => ( + <> +
+
{item.icon}
+ + {item.description} + +
- {!!selected && ( - - - )} - - )} -
- ))} -
+ {!!selected && ( + + + )} + + )} +
+ ))} +
+
diff --git a/src/components/DropdownMenu/index.tsx b/src/components/DropdownMenu/index.tsx index 4148493d4..3913d0fef 100644 --- a/src/components/DropdownMenu/index.tsx +++ b/src/components/DropdownMenu/index.tsx @@ -1,4 +1,5 @@ import { Menu, Transition } from "@headlessui/react"; +import { Fragment } from "react"; type DropdownMenuProps = { buttonElement: JSX.Element; @@ -24,6 +25,7 @@ export function DropdownMenu({ {buttonElement} {/* @ts-ignore */} >; @@ -28,6 +28,7 @@ const Items = ({ }: ItemsProps) => ( /* @ts-ignore */ {/* @ts-ignore */} {/* @ts-ignore */} {/* @ts-ignore */}