Skip to content

Commit

Permalink
fix: type fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Usmanfee committed Dec 10, 2024
1 parent c0fe228 commit d0ce9b4
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/components/shared/basic/KeyValueView/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import {
interface KeyValueViewProps {
cols: number
title: string
items: Array<ValueItem>
items: ValueItem | Array<ValueItem>
editLink?: string
setTechnicalUserDetailList?: Dispatch<SetStateAction<ValueItem[]>>
}
Expand Down Expand Up @@ -104,10 +104,12 @@ export const KeyValueView = ({
{item.showHideButton && setTechnicalUserDetailList && (
<Box
onClick={() => {
const updatedItems = items.map((itm) =>
itm.key === item.key ? { ...itm, masked: !itm.masked } : itm
)
setTechnicalUserDetailList(updatedItems)
if (Array.isArray(items)) {
const updatedItems = items.map((itm) =>
itm.key === item.key ? { ...itm, masked: !itm.masked } : itm
)
setTechnicalUserDetailList(updatedItems)
}
}}
sx={{
color: item.masked ? '#eeeeee' : '#cccccc',
Expand Down

0 comments on commit d0ce9b4

Please sign in to comment.