From eb5502a16f86e37a933f6beca0678c2d228e77d5 Mon Sep 17 00:00:00 2001 From: Danshil Kokil Mungur Date: Thu, 23 Feb 2023 19:27:26 +0400 Subject: [PATCH] fix(ui): prevent title cards from flickering when quickly hovering across them (#3349) * fix(ui): remove opacity classes from transition enter and leave props The flickering was caused by the opacity classes in the `leave` prop to take effect as the transition ends; when the `leaveTo` prop classes are no longer applied, but the `leave` prop classes are still applied. * fix(ui): resolve transition issues for all components 1. Remove opacity classes from `enter` and `leave` props 2. Fix some class name typos 3. Remove transform classes since those are automatically applied as from TailwindCSS v3.0 4. Narrow down `transition` classes to only the properties being transitioned in Transition components --- .../Common/ButtonWithDropdown/index.tsx | 12 ++++++------ src/components/Common/Modal/index.tsx | 14 +++++++------- src/components/Common/SlideCheckbox/index.tsx | 2 +- src/components/Common/SlideOver/index.tsx | 8 ++++---- src/components/Discover/index.tsx | 4 ++-- .../IssueDetails/IssueComment/index.tsx | 14 +++++++------- .../IssueDetails/IssueDescription/index.tsx | 8 ++++---- src/components/IssueDetails/index.tsx | 4 ++-- src/components/IssueModal/index.tsx | 4 ++-- src/components/Layout/LanguagePicker/index.tsx | 12 ++++++------ src/components/Layout/MobileMenu/index.tsx | 6 +++--- src/components/Layout/Sidebar/index.tsx | 4 ++-- src/components/Layout/UserDropdown/index.tsx | 8 ++++---- src/components/Login/index.tsx | 4 ++-- src/components/RegionSelector/index.tsx | 2 +- .../RequestModal/AdvancedRequester/index.tsx | 4 ++-- .../RequestModal/CollectionRequestModal.tsx | 4 ++-- src/components/RequestModal/TvRequestModal.tsx | 4 ++-- src/components/RequestModal/index.tsx | 4 ++-- src/components/Settings/LibraryItem.tsx | 2 +- src/components/Settings/RadarrModal/index.tsx | 6 +++--- .../Settings/SettingsAbout/Releases/index.tsx | 4 ++-- .../Settings/SettingsJobsCache/index.tsx | 4 ++-- src/components/Settings/SettingsLogs/index.tsx | 4 ++-- src/components/Settings/SettingsServices.tsx | 6 +++--- src/components/Settings/SonarrModal/index.tsx | 6 +++--- src/components/StatusChecker/index.tsx | 4 ++-- src/components/TitleCard/index.tsx | 8 ++++---- src/components/TvDetails/index.tsx | 14 +++++++------- src/components/UserList/PlexImportModal.tsx | 4 ++-- src/components/UserList/index.tsx | 16 ++++++++-------- 31 files changed, 100 insertions(+), 100 deletions(-) diff --git a/src/components/Common/ButtonWithDropdown/index.tsx b/src/components/Common/ButtonWithDropdown/index.tsx index b5bc0cb64..b0d314d1a 100644 --- a/src/components/Common/ButtonWithDropdown/index.tsx +++ b/src/components/Common/ButtonWithDropdown/index.tsx @@ -101,12 +101,12 @@ const ButtonWithDropdown = ({
( appear as="div" className="fixed top-0 bottom-0 left-0 right-0 z-50 flex h-full w-full items-center justify-center bg-gray-800 bg-opacity-70" - enter="transition opacity-0 duration-300" + enter="transition-opacity duration-300" enterFrom="opacity-0" enterTo="opacity-100" - leave="transition opacity-100 duration-300" + leave="transition-opacity duration-300" leaveFrom="opacity-100" leaveTo="opacity-0" ref={parentRef} @@ -89,10 +89,10 @@ const Modal = React.forwardRef( (
( }} appear as="div" - enter="transition opacity-0 duration-300 transform scale-75" + enter="transition duration-300" enterFrom="opacity-0 scale-75" enterTo="opacity-100 scale-100" - leave="transition opacity-100 duration-300" + leave="transition-opacity duration-300" leaveFrom="opacity-100" leaveTo="opacity-0" show={!loading} diff --git a/src/components/Common/SlideCheckbox/index.tsx b/src/components/Common/SlideCheckbox/index.tsx index a514d6c03..320dd667f 100644 --- a/src/components/Common/SlideCheckbox/index.tsx +++ b/src/components/Common/SlideCheckbox/index.tsx @@ -29,7 +29,7 @@ const SlideCheckbox = ({ onClick, checked = false }: SlideCheckboxProps) => { aria-hidden="true" className={`${ checked ? 'translate-x-5' : 'translate-x-0' - } absolute left-0 inline-block h-5 w-5 transform rounded-full border border-gray-200 bg-white shadow transition-transform duration-200 ease-in-out group-focus:border-blue-300 group-focus:ring`} + } absolute left-0 inline-block h-5 w-5 rounded-full border border-gray-200 bg-white shadow transition-transform duration-200 ease-in-out group-focus:border-blue-300 group-focus:ring`} > ); diff --git a/src/components/Common/SlideOver/index.tsx b/src/components/Common/SlideOver/index.tsx index 48c1f8549..6da8972a8 100644 --- a/src/components/Common/SlideOver/index.tsx +++ b/src/components/Common/SlideOver/index.tsx @@ -37,10 +37,10 @@ const SlideOver = ({ as={Fragment} show={show} appear - enter="opacity-0 transition ease-in-out duration-300" + enter="transition-opacity ease-in-out duration-300" enterFrom="opacity-0" enterTo="opacity-100" - leave="opacity-100 transition ease-in-out duration-300" + leave="transition-opacity ease-in-out duration-300" leaveFrom="opacity-100" leaveTo="opacity-0" > @@ -58,10 +58,10 @@ const SlideOver = ({
diff --git a/src/components/Discover/index.tsx b/src/components/Discover/index.tsx index b9071b424..74383f13b 100644 --- a/src/components/Discover/index.tsx +++ b/src/components/Discover/index.tsx @@ -165,10 +165,10 @@ const Discover = () => { )}
diff --git a/src/components/IssueDetails/IssueDescription/index.tsx b/src/components/IssueDetails/IssueDescription/index.tsx index 7121f0952..7dc8c8d31 100644 --- a/src/components/IssueDetails/IssueDescription/index.tsx +++ b/src/components/IssueDetails/IssueDescription/index.tsx @@ -57,11 +57,11 @@ const IssueDescription = ({ show={open} as="div" enter="transition ease-out duration-100" - enterFrom="transform opacity-0 scale-95" - enterTo="transform opacity-100 scale-100" + enterFrom="opacity-0 scale-95" + enterTo="opacity-100 scale-100" leave="transition ease-in duration-75" - leaveFrom="transform opacity-100 scale-100" - leaveTo="transform opacity-0 scale-95" + leaveFrom="opacity-100 scale-100" + leaveTo="opacity-0 scale-95" > { ( {
{ show={isOpen} as="div" ref={ref} - enter="transition transform duration-500" + enter="transition duration-500" enterFrom="opacity-0 translate-y-0" enterTo="opacity-100 -translate-y-full" - leave="transition duration-500 transform" + leave="transition duration-500" leaveFrom="opacity-100 -translate-y-full" leaveTo="opacity-0 translate-y-0" - className="absolute top-0 left-0 right-0 flex w-full -translate-y-full transform flex-col space-y-6 border-t border-gray-600 bg-gray-900 bg-opacity-90 px-6 py-6 font-semibold text-gray-100 backdrop-blur" + className="absolute top-0 left-0 right-0 flex w-full -translate-y-full flex-col space-y-6 border-t border-gray-600 bg-gray-900 bg-opacity-90 px-6 py-6 font-semibold text-gray-100 backdrop-blur" > {filteredLinks.map((link) => { const isActive = router.pathname.match(link.activeRegExp); diff --git a/src/components/Layout/Sidebar/index.tsx b/src/components/Layout/Sidebar/index.tsx index 4baf56a67..d9f8ffd51 100644 --- a/src/components/Layout/Sidebar/index.tsx +++ b/src/components/Layout/Sidebar/index.tsx @@ -127,10 +127,10 @@ const Sidebar = ({ open, setClosed }: SidebarProps) => { diff --git a/src/components/Layout/UserDropdown/index.tsx b/src/components/Layout/UserDropdown/index.tsx index c21a9c506..6d3fe7b98 100644 --- a/src/components/Layout/UserDropdown/index.tsx +++ b/src/components/Layout/UserDropdown/index.tsx @@ -63,11 +63,11 @@ const UserDropdown = () => { diff --git a/src/components/Login/index.tsx b/src/components/Login/index.tsx index 5ad862b1e..fe92629a6 100644 --- a/src/components/Login/index.tsx +++ b/src/components/Login/index.tsx @@ -95,10 +95,10 @@ const Login = () => { diff --git a/src/components/RegionSelector/index.tsx b/src/components/RegionSelector/index.tsx index d0a0113eb..38febf9a8 100644 --- a/src/components/RegionSelector/index.tsx +++ b/src/components/RegionSelector/index.tsx @@ -122,7 +122,7 @@ const RegionSelector = ({