1867 timebox add storybook tests on meta typesinputcomponents (#1972)

* working on DateFieldInput story

* wip

* wip

* wip

* Fix story

* Fix other story

* finish stories for BooleanFieldInput and DateFieldInput

* reorganize stories in UI/Field in Input and Display folders

* unite FieldDisplayContextProvider and FieldInputContextProvider in one file FieldContextProvider

---------

Co-authored-by: Charles Bochet <charles@twenty.com>
This commit is contained in:
bosiraphael
2023-10-11 16:55:55 +02:00
committed by GitHub
parent c52b297612
commit b2352212fc
14 changed files with 290 additions and 49 deletions

View File

@ -20,9 +20,14 @@ const StyledEditableBooleanFieldValue = styled.div`
type BooleanInputProps = {
value: boolean;
onToggle?: (newValue: boolean) => void;
testId?: string;
};
export const BooleanInput = ({ value, onToggle }: BooleanInputProps) => {
export const BooleanInput = ({
value,
onToggle,
testId,
}: BooleanInputProps) => {
const [internalValue, setInternalValue] = useState(value);
useEffect(() => {
@ -37,7 +42,10 @@ export const BooleanInput = ({ value, onToggle }: BooleanInputProps) => {
const theme = useTheme();
return (
<StyledEditableBooleanFieldContainer onClick={handleClick}>
<StyledEditableBooleanFieldContainer
onClick={handleClick}
data-testid={testId}
>
{internalValue ? (
<IconCheck size={theme.icon.size.sm} />
) : (