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

@ -111,7 +111,8 @@ export const SnackBar = ({
variant = 'info',
children,
onClose,
...rootProps
id,
title,
}: SnackBarProps) => {
const theme = useTheme();
@ -156,12 +157,7 @@ export const SnackBar = ({
return (
<StyledMotionContainer
aria-live={role === 'alert' ? 'assertive' : 'polite'}
role={role}
onMouseEnter={onMouseEnter}
onMouseLeave={onMouseLeave}
variant={variant}
// eslint-disable-next-line twenty/no-spread-props
{...rootProps}
{...{ id, onMouseEnter, onMouseLeave, role, title, variant }}
>
<StyledProgressBarContainer>
<ProgressBar

View File

@ -69,23 +69,24 @@ export const SnackBarProvider = ({ children }: React.PropsWithChildren) => {
<>
{children}
<StyledSnackBarContainer>
{snackBarInternal.queue.map((snackBar) => (
<StyledSnackBarMotionContainer
key={snackBar.id}
variants={reducedMotion ? reducedVariants : variants}
initial="initial"
animate="animate"
exit="exit"
transition={{ duration: 0.5 }}
layout
>
<SnackBar
// eslint-disable-next-line twenty/no-spread-props
{...snackBar}
onClose={() => handleSnackBarClose(snackBar.id)}
/>
</StyledSnackBarMotionContainer>
))}
{snackBarInternal.queue.map(
({ duration, icon, id, message, title, variant }) => (
<StyledSnackBarMotionContainer
key={id}
variants={reducedMotion ? reducedVariants : variants}
initial="initial"
animate="animate"
exit="exit"
transition={{ duration: 0.5 }}
layout
>
<SnackBar
{...{ duration, icon, message, title, variant }}
onClose={() => handleSnackBarClose(id)}
/>
</StyledSnackBarMotionContainer>
),
)}
</StyledSnackBarContainer>
</>
);