import React, { useMemo } from 'react' import cx from 'classnames' import { Icon } from '@harnessio/icons' import { Avatar, Container, FlexExpander, Layout, Text } from '@harnessio/uicore' import css from './BranchProtectionForm.module.scss' const BypassList = (props: { bypassList?: string[] // eslint-disable-next-line @typescript-eslint/no-explicit-any setFieldValue: (field: string, value: any, shouldValidate?: boolean | undefined) => void }) => { const { bypassList, setFieldValue } = props const bypassContent = useMemo(() => { return ( {bypassList?.map((owner: string, idx: number) => { const name = owner.slice(owner.indexOf(' ') + 1) return ( {name} { const filteredData = bypassList.filter(item => !(item[0] === owner[0] && item[1] === owner[1])) setFieldValue('bypassList', filteredData) }} className={css.codeClose} /> ) })} ) }, [bypassList, setFieldValue]) return <>{bypassContent} } export default BypassList