From 8e77c379f61b7f18676ccce0a12cd46dc687eaad Mon Sep 17 00:00:00 2001 From: Timofey Boyko Date: Wed, 19 Jul 2023 10:28:05 +0300 Subject: [PATCH] Web:Components:Selector: fix types after merge master --- packages/components/selector/Selector.types.ts | 1 + packages/components/selector/index.tsx | 9 +++------ .../selector/sub-components/Body/Body.types.ts | 1 + .../selector/sub-components/Body/StyledBody.ts | 9 +++++++-- 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/packages/components/selector/Selector.types.ts b/packages/components/selector/Selector.types.ts index e805396597..29144080b9 100644 --- a/packages/components/selector/Selector.types.ts +++ b/packages/components/selector/Selector.types.ts @@ -17,6 +17,7 @@ export type SelectorProps = { id?: string; className?: string; style?: React.CSSProperties; + withHeader?: boolean; headerLabel: string; withoutBackButton?: boolean; onBackClick?: () => void; diff --git a/packages/components/selector/index.tsx b/packages/components/selector/index.tsx index 98dbc06e5e..3014a59e05 100644 --- a/packages/components/selector/index.tsx +++ b/packages/components/selector/index.tsx @@ -67,11 +67,8 @@ const Selector = ({ loadNextPage, totalItems, isLoading, - searchLoader, - rowLoader, + withHeader, -}) => { - const [footerVisible, setFooterVisible] = React.useState(false); withFooterInput, withFooterCheckbox, @@ -394,8 +391,8 @@ const Selector = ({ // /** Accepts css style */ // style: PropTypes.object, - /** Add header */ - withHeader: PropTypes.bool, +/** Add header */ +// withHeader: PropTypes.bool, // /** Selector header text */ // headerLabel: PropTypes.string, // /** Hide header back button */ diff --git a/packages/components/selector/sub-components/Body/Body.types.ts b/packages/components/selector/sub-components/Body/Body.types.ts index 88c265937a..7c987ad25c 100644 --- a/packages/components/selector/sub-components/Body/Body.types.ts +++ b/packages/components/selector/sub-components/Body/Body.types.ts @@ -3,6 +3,7 @@ import { Item } from "./../Item/Item.types"; export type BodyProps = { footerVisible: boolean; + withHeader?: boolean; isSearch: boolean; isAllIndeterminate?: boolean; isAllChecked?: boolean; diff --git a/packages/components/selector/sub-components/Body/StyledBody.ts b/packages/components/selector/sub-components/Body/StyledBody.ts index bb116376ba..0a6a1ec2a0 100644 --- a/packages/components/selector/sub-components/Body/StyledBody.ts +++ b/packages/components/selector/sub-components/Body/StyledBody.ts @@ -4,6 +4,7 @@ import Base from "../../../themes/base"; const StyledBody = styled.div<{ footerVisible: boolean; + withHeader?: boolean; footerHeight: number; headerHeight: number; }>` @@ -11,8 +12,12 @@ const StyledBody = styled.div<{ height: ${(props) => props.footerVisible - ? `calc(100% - 16px - ${props.footerHeight}px - ${props.headerHeight}px)` - : `calc(100% - 16px - ${props.headerHeight}px)`}; + ? props.withHeader + ? `calc(100% - 16px - ${props.footerHeight}px - ${props.headerHeight}px)` + : `calc(100% - 16px - ${props.footerHeight}px)` + : props.withHeader + ? `calc(100% - 16px - ${props.headerHeight}px)` + : `calc(100% - 16px)`}; padding: 16px 0 0 0;