Update the frontend to adhere to the custom eslint rule twenty/no-spread-props (#1958)

* Update the frontend to adhere to the custom eslint rule `twenty/no-spread-props`

Co-authored-by: v1b3m <vibenjamin6@gmail.com>

* Update the frontend to adhere to the custom eslint rule `twenty/no-spread-props`

Co-authored-by: v1b3m <vibenjamin6@gmail.com>

* resolve bug with data-testid

---------

Co-authored-by: v1b3m <vibenjamin6@gmail.com>
Co-authored-by: bosiraphael <raphael.bosi@gmail.com>
This commit is contained in:
gitstart-twenty
2023-10-10 16:40:49 +03:00
committed by GitHub
parent 5dddd77eb3
commit bf397bc6ec
33 changed files with 276 additions and 169 deletions

View File

@ -27,7 +27,6 @@ export const DropdownMenuContainer = ({
children,
onClose,
width,
...props
}: DropdownMenuContainerProps) => {
const dropdownRef = useRef(null);
@ -39,8 +38,7 @@ export const DropdownMenuContainer = ({
});
return (
// eslint-disable-next-line twenty/no-spread-props
<StyledDropdownMenuContainer data-select-disable {...props} anchor={anchor}>
<StyledDropdownMenuContainer data-select-disable anchor={anchor}>
<StyledDropdownMenu ref={dropdownRef} width={width}>
{children}
</StyledDropdownMenu>

View File

@ -30,6 +30,7 @@ type DropdownMenuHeaderProps = ComponentProps<'li'> & {
StartIcon?: IconComponent;
EndIcon?: IconComponent;
onClick?: (event: MouseEvent<HTMLButtonElement>) => void;
testId?: string;
};
export const DropdownMenuHeader = ({
@ -37,14 +38,13 @@ export const DropdownMenuHeader = ({
StartIcon,
EndIcon,
onClick,
...props
testId,
}: DropdownMenuHeaderProps) => {
return (
// eslint-disable-next-line twenty/no-spread-props
<StyledHeader {...props}>
<StyledHeader data-testid={testId}>
{StartIcon && (
<LightIconButton
data-testid="dropdown-menu-header-end-icon"
testId="dropdown-menu-header-end-icon"
Icon={StartIcon}
onClick={onClick}
accent="tertiary"

View File

@ -36,9 +36,12 @@ const StyledInput = styled.input`
export const DropdownMenuSearchInput = forwardRef<
HTMLInputElement,
InputHTMLAttributes<HTMLInputElement>
>((props, ref) => (
>(({ value, onChange, autoFocus, placeholder = 'Search', type }, ref) => (
<StyledDropdownMenuSearchInputContainer>
{/* eslint-disable-next-line twenty/no-spread-props */}
<StyledInput autoComplete="off" placeholder="Search" {...props} ref={ref} />
<StyledInput
autoComplete="off"
{...{ autoFocus, onChange, placeholder, type, value }}
ref={ref}
/>
</StyledDropdownMenuSearchInputContainer>
));