From 820eda7b10b9bd22731d28b08ca1ec35429065e2 Mon Sep 17 00:00:00 2001 From: Luke Bennett Date: Thu, 27 Oct 2022 14:27:10 +1100 Subject: [PATCH] Convert TestSuite to functional component --- docs/Tests.tsx | 323 ++++++++++++++++++++++++------------------------- 1 file changed, 156 insertions(+), 167 deletions(-) diff --git a/docs/Tests.tsx b/docs/Tests.tsx index cbbcab70f7..58daf08939 100644 --- a/docs/Tests.tsx +++ b/docs/Tests.tsx @@ -1,8 +1,8 @@ import React, { ChangeEventHandler, - Component, ComponentProps, ComponentType, + useState, } from 'react'; import Select, { MenuPlacement } from 'react-select'; @@ -15,14 +15,6 @@ interface SuiteProps { readonly selectComponent: ComponentType>; readonly idSuffix: string; } -interface SuiteState { - readonly isDisabled: boolean; - readonly isFixed: boolean; - readonly isLoading: boolean; - readonly escapeClearsValue: boolean; - readonly blockScroll: boolean; - readonly portalPlacement: MenuPlacement; -} const AnimatedSelect = (props: ComponentProps) => ( - Disabled - - - - Loading - - + const menuPortalTarget = !isFixed ? document.body : null; -

Grouped

-
- +
+ ({ ...base, zIndex: 999 }), + }} + isDisabled={isDisabled} + isLoading={isLoading} + options={colourOptions} + /> + + + Disabled + + + -
+ Loading + +
+ +

Grouped

+
+ +
-

Clearable

-
- Clearable +
+ + + - - - escapeClearsValue - -
+ escapeClearsValue + +
-

Portalled

-
-
-
{'overflow: hidden; position: absolute;'}
- Portalled +
+
+
{'overflow: hidden; position: absolute;'}
+ + + + + + + Fixed + + + + Portal + + + - - - - - - Fixed - - - - Portal - - - - Block Scroll - -
-
+ Block Scroll +
+
- ); - } -} +
+ ); +}; export default function Tests() { return (