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:
@ -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} />
|
||||
) : (
|
||||
|
||||
Reference in New Issue
Block a user