Skip to content

Commit 0a7d2ec

Browse files
author
Amrit Kashyap Borah
committed
fix: review comments
1 parent 959491c commit 0a7d2ec

5 files changed

Lines changed: 14 additions & 33 deletions

File tree

src/Common/PopupMenu.tsx

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
import React, { forwardRef, useEffect } from 'react'
17+
import React, { useEffect } from 'react'
1818
import { Modal } from './Modals/Modal'
1919
import { PopupMenuBodyType, PopupMenuButtonType, PopupMenuType } from './Types'
2020

@@ -155,33 +155,19 @@ const PopupMenu = ({
155155
)
156156
}
157157

158-
const Button = forwardRef(({
158+
const Button = ({
159159
children = null,
160160
disabled = false,
161161
rootClassName = '',
162162
tabIndex = 0,
163163
onHover = false,
164164
isKebab = false,
165165
dataTestId = '',
166-
}: PopupMenuButtonType, forwardedRef) => {
166+
}: PopupMenuButtonType) => {
167167
const { handleOpen, popupPosition, buttonRef, initialiseButtonWidth } = usePopupContext()
168-
169-
const refCallback = (node) => {
170-
buttonRef.current = node
171-
172-
if (typeof forwardedRef === 'function') {
173-
forwardedRef(node)
174-
return
175-
}
176-
177-
if (forwardedRef && typeof forwardedRef === 'object') {
178-
forwardedRef.current = node
179-
}
180-
}
181-
182168
return (
183169
<button
184-
ref={refCallback}
170+
ref={initialiseButtonWidth}
185171
type="button"
186172
tabIndex={tabIndex}
187173
disabled={disabled}
@@ -195,7 +181,7 @@ const Button = forwardRef(({
195181
{children}
196182
</button>
197183
)
198-
})
184+
}
199185

200186
const Body = ({
201187
children = null,

src/Pages/ResourceBrowser/ResourceBrowser.Types.ts

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,8 @@
1414
* limitations under the License.
1515
*/
1616

17-
import { Dispatch, ReactNode, RefObject, SetStateAction } from 'react'
18-
import { GroupBase } from 'react-select'
17+
import { ReactNode, RefObject } from 'react'
1918

20-
import { ServerErrors } from '@Common/ServerError'
21-
import { SelectPickerOptionType } from '@Shared/Components'
2219
import { Nodes, NodeType } from '@Shared/types'
2320

2421
export interface GVKType {
@@ -204,15 +201,6 @@ export interface GVKOptionValueType {
204201
apiVersion: string
205202
}
206203

207-
export interface GetResourceRecommenderResourceListPropsType {
208-
setShowAbsoluteValuesInResourceRecommender: Dispatch<SetStateAction<boolean>>
209-
showAbsoluteValuesInResourceRecommender: boolean
210-
gvkOptions: GroupBase<SelectPickerOptionType<GVKOptionValueType>>[]
211-
areGVKOptionsLoading: boolean
212-
reloadGVKOptions: () => void
213-
gvkOptionsError: ServerErrors
214-
}
215-
216204
export interface ResourceRecommenderActionMenuProps {
217205
children: ReactNode
218206
lastScannedOn: string

src/Shared/Components/BulkSelection/types.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,9 @@ export interface BulkSelectionProps {
5454
*/
5555
showChevronDownIcon?: boolean
5656
disabled?: boolean
57+
/**
58+
* If true, pressing the checkbox will select all items on page if list is not paginated
59+
*/
5760
selectAllIfNotPaginated?: boolean
5861
}
5962

src/Shared/Components/Button/types.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
import { AnchorHTMLAttributes, ButtonHTMLAttributes, ReactElement } from 'react'
17+
import { AnchorHTMLAttributes, ButtonHTMLAttributes, ReactElement, Ref } from 'react'
1818
import { LinkProps } from 'react-router-dom'
1919

2020
import { TooltipProps } from '@Common/Tooltip'
@@ -48,6 +48,7 @@ export enum ButtonComponentType {
4848
export type ButtonProps<ComponentType extends ButtonComponentType = ButtonComponentType.button> =
4949
(ComponentType extends ButtonComponentType.link
5050
? {
51+
ref?: Ref<HTMLAnchorElement>
5152
component: ButtonComponentType.link
5253
/**
5354
* Props for the link component
@@ -59,6 +60,7 @@ export type ButtonProps<ComponentType extends ButtonComponentType = ButtonCompon
5960
}
6061
: ComponentType extends ButtonComponentType.anchor
6162
? {
63+
ref?: Ref<HTMLAnchorElement>
6264
component: ButtonComponentType.anchor
6365
linkProps?: never
6466
buttonProps?: never
@@ -74,6 +76,7 @@ export type ButtonProps<ComponentType extends ButtonComponentType = ButtonCompon
7476
onClick?: AnchorHTMLAttributes<HTMLAnchorElement>['onClick']
7577
}
7678
: {
79+
ref?: Ref<HTMLButtonElement>
7780
/**
7881
* Component to be rendered from the available options
7982
*

src/Shared/Components/Popover/usePopover.hook.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ export const usePopover = ({
130130
onKeyDown: handleTriggerKeyDown,
131131
'aria-haspopup': 'listbox',
132132
'aria-expanded': open,
133+
className: 'flex',
133134
tabIndex: 0,
134135
bounds: triggerBounds ?? { left: 0, top: 0, height: 0, width: 0 },
135136
},

0 commit comments

Comments
 (0)