Refactor/remove react table (#642)

* Refactored tables without tan stack
* Fixed checkbox behavior with multiple handlers on click
* Fixed hotkeys scope
* Fix debounce in editable cells
* Lowered coverage

---------

Co-authored-by: Charles Bochet <charles@twenty.com>
This commit is contained in:
Lucas Bordeau
2023-07-13 19:08:13 +02:00
committed by GitHub
parent e7d48d5373
commit 734e18e01a
88 changed files with 1789 additions and 671 deletions

View File

@ -2,9 +2,7 @@ import * as React from 'react';
import styled from '@emotion/styled';
type OwnProps = {
name?: string;
id?: string;
checked?: boolean;
checked: boolean;
indeterminate?: boolean;
onChange?: (newCheckedValue: boolean) => void;
};
@ -41,13 +39,7 @@ const StyledContainer = styled.div`
}
`;
export function Checkbox({
name,
id,
checked,
onChange,
indeterminate,
}: OwnProps) {
export function Checkbox({ checked, onChange, indeterminate }: OwnProps) {
const ref = React.useRef<HTMLInputElement>(null);
React.useEffect(() => {
@ -57,10 +49,8 @@ export function Checkbox({
}
}, [ref, indeterminate, checked]);
function handleInputChange(event: React.ChangeEvent<HTMLInputElement>) {
if (onChange) {
onChange(event.target.checked);
}
function handleChange(event: React.ChangeEvent<HTMLInputElement>) {
onChange?.(event.target.checked);
}
return (
@ -69,10 +59,8 @@ export function Checkbox({
ref={ref}
type="checkbox"
data-testid="input-checkbox"
id={id}
name={name}
checked={checked}
onChange={handleInputChange}
onChange={handleChange}
/>
</StyledContainer>
);