Skip to content

Commit ce0e89c

Browse files
committed
refactor: remove height to deduct from Reload, ErrorScreenManager and ErrorPage
1 parent 19a69a0 commit ce0e89c

File tree

4 files changed

+3
-16
lines changed

4 files changed

+3
-16
lines changed

src/Common/ErrorPage.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import GenericEmptyState from './EmptyState/GenericEmptyState'
2020
import { ErrorPageType } from './Types'
2121
import { noop, refresh, reportIssue } from './Helper'
2222

23-
const ErrorPage = ({ code, image, title, subTitle, imageType, heightToDeduct, redirectURL, reload }: ErrorPageType) => {
23+
const ErrorPage = ({ code, image, title, subTitle, imageType, redirectURL, reload }: ErrorPageType) => {
2424
const { push } = useHistory()
2525
const redirectToHome = () => {
2626
push(redirectURL || `/${ROUTES.APP_LIST}`)
@@ -75,7 +75,6 @@ const ErrorPage = ({ code, image, title, subTitle, imageType, heightToDeduct, re
7575
isButtonAvailable={isButtonAvailable}
7676
renderButton={renderGenerateButton}
7777
imageType={imageType}
78-
heightToDeduct={heightToDeduct}
7978
/>
8079
)
8180
}

src/Common/ErrorScreenManager.tsx

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ const ErrorScreenManager = ({
2727
reload,
2828
subtitle,
2929
reloadClass,
30-
heightToDeduct,
3130
redirectURL,
3231
imageType = ImageType.Large,
3332
}: ErrorScreenManagerProps) => {
@@ -41,7 +40,6 @@ const ErrorScreenManager = ({
4140
subTitle={subtitle || ERROR_EMPTY_SCREEN.BAD_REQUEST_MESSAGE}
4241
image={badRequest}
4342
imageType={imageType}
44-
heightToDeduct={heightToDeduct}
4543
reload={reload}
4644
/>
4745
)
@@ -53,7 +51,6 @@ const ErrorScreenManager = ({
5351
subTitle={subtitle || ERROR_EMPTY_SCREEN.UNAUTHORIZED_MESSAGE}
5452
image={unauthorized}
5553
imageType={imageType}
56-
heightToDeduct={heightToDeduct}
5754
/>
5855
)
5956
case ERROR_STATUS_CODE.PERMISSION_DENIED:
@@ -64,7 +61,6 @@ const ErrorScreenManager = ({
6461
subTitle={subtitle || ERROR_EMPTY_SCREEN.FORBIDDEN_MESSAGE}
6562
image={unauthorized}
6663
imageType={imageType}
67-
heightToDeduct={heightToDeduct}
6864
/>
6965
)
7066
case ERROR_STATUS_CODE.NOT_FOUND:
@@ -75,7 +71,6 @@ const ErrorScreenManager = ({
7571
subTitle={subtitle || ERROR_EMPTY_SCREEN.PAGE_NOT_EXIST}
7672
image={notFound}
7773
imageType={imageType}
78-
heightToDeduct={heightToDeduct}
7974
redirectURL={redirectURL}
8075
/>
8176
)
@@ -87,7 +82,6 @@ const ErrorScreenManager = ({
8782
subTitle={subtitle || ERROR_EMPTY_SCREEN.INTERNAL_SERVER_ERROR_MESSAGE}
8883
image={badRequest}
8984
imageType={imageType}
90-
heightToDeduct={heightToDeduct}
9185
reload={reload}
9286
/>
9387
)
@@ -99,7 +93,6 @@ const ErrorScreenManager = ({
9993
subTitle={subtitle || ERROR_EMPTY_SCREEN.BAD_GATEWAY_MESSAGE}
10094
image={badRequest}
10195
imageType={imageType}
102-
heightToDeduct={heightToDeduct}
10396
reload={reload}
10497
/>
10598
)
@@ -111,12 +104,11 @@ const ErrorScreenManager = ({
111104
subTitle={subtitle || ERROR_EMPTY_SCREEN.SERVICE_TEMPORARY_UNAVAILABLE_MESSAGE}
112105
image={badRequest}
113106
imageType={imageType}
114-
heightToDeduct={heightToDeduct}
115107
reload={reload}
116108
/>
117109
)
118110
default:
119-
return <Reload heightToDeduct={heightToDeduct} reload={reload} className={reloadClass} />
111+
return <Reload reload={reload} className={reloadClass} />
120112
}
121113
}
122114
return getMessage()

src/Common/Reload.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,10 @@ import { refresh } from './Helper'
2121
/**
2222
* @deprecated Use APIResponseHandler (Preferred) or error screen manager instead
2323
*/
24-
export default function Reload({ reload, className = '', heightToDeduct = 0 }: ReloadType) {
24+
export default function Reload({ reload, className = '' }: ReloadType) {
2525
return (
2626
<article
2727
className={`flex w-100 h-100 ${className}`}
28-
{...(heightToDeduct > 0 && { style: { height: `calc(100vh - ${heightToDeduct}px)` } })}
2928
>
3029
<div className="flex column w-250 dc__align-center" data-testid="reload">
3130
<img src={loadingFailure} style={{ height: 'auto' }} className="w-100 mb-12" alt="load-error" />

src/Common/Types.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,6 @@ export interface ErrorPageType
180180
extends Pick<GenericEmptyStateType, 'image' | 'title' | 'subTitle' | 'renderButton' | 'imageType'>,
181181
Pick<ErrorScreenManagerProps, 'reload' | 'redirectURL'> {
182182
code: number
183-
heightToDeduct?: number
184183
redirectURL?: string
185184
reload?: () => void
186185
}
@@ -191,7 +190,6 @@ export interface ErrorScreenManagerProps {
191190
reload?: (...args) => any
192191
subtitle?: React.ReactChild
193192
reloadClass?: string
194-
heightToDeduct?: number
195193
/**
196194
* Would be used to redirect URL in case of 404
197195
* @default - APP_LIST
@@ -258,7 +256,6 @@ export type InfoColourBarType = InfoColourBarMessageProp & {
258256
export interface ReloadType {
259257
reload?: (event?: any) => void
260258
className?: string
261-
heightToDeduct?: number
262259
}
263260

264261
export interface RadioGroupItemProps {

0 commit comments

Comments
 (0)