a4ed043d43
As title
55 lines
1.6 KiB
TypeScript
55 lines
1.6 KiB
TypeScript
import { type LogicFunctionNewFormValues } from '@/logic-functions/hooks/useLogicFunctionUpdateFormState';
|
|
import { SettingsTextInput } from '@/ui/input/components/SettingsTextInput';
|
|
import { TextArea } from '@/ui/input/components/TextArea';
|
|
import styled from '@emotion/styled';
|
|
import { t } from '@lingui/core/macro';
|
|
import { H2Title } from 'twenty-ui/display';
|
|
import { Section } from 'twenty-ui/layout';
|
|
|
|
const StyledInputsContainer = styled.div`
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: ${({ theme }) => theme.spacing(4)};
|
|
`;
|
|
|
|
export const SettingsLogicFunctionNewForm = ({
|
|
formValues,
|
|
onChange,
|
|
readonly = false,
|
|
}: {
|
|
formValues: LogicFunctionNewFormValues;
|
|
onChange: (key: string) => (value: string) => void;
|
|
readonly?: boolean;
|
|
}) => {
|
|
const descriptionTextAreaId = `${formValues.name}-description`;
|
|
const nameTextInputId = `${formValues.name}-name`;
|
|
|
|
return (
|
|
<Section>
|
|
<H2Title
|
|
title={t`About`}
|
|
description={t`Name and describe your function`}
|
|
/>
|
|
<StyledInputsContainer>
|
|
<SettingsTextInput
|
|
instanceId={nameTextInputId}
|
|
placeholder={t`Name`}
|
|
fullWidth
|
|
autoFocusOnMount
|
|
value={formValues.name}
|
|
onChange={onChange('name')}
|
|
readOnly={readonly}
|
|
/>
|
|
<TextArea
|
|
textAreaId={descriptionTextAreaId}
|
|
placeholder={t`Description`}
|
|
minRows={4}
|
|
value={formValues.description}
|
|
onChange={onChange('description')}
|
|
readOnly={readonly}
|
|
/>
|
|
</StyledInputsContainer>
|
|
</Section>
|
|
);
|
|
};
|