refactor: reuse base TextInput component

This commit is contained in:
Devessier 2024-11-21 12:04:42 +01:00
parent 7c3791a098
commit 510e0ff605

View File

@ -1,9 +1,9 @@
import { TextInput } from '@/ui/field/input/components/TextInput';
import { SortOrFilterChip } from '@/views/components/SortOrFilterChip'; import { SortOrFilterChip } from '@/views/components/SortOrFilterChip';
import SearchVariablesDropdown from '@/workflow/search-variables/components/SearchVariablesDropdown'; import SearchVariablesDropdown from '@/workflow/search-variables/components/SearchVariablesDropdown';
import { extractVariableLabel } from '@/workflow/search-variables/utils/extractVariableLabel'; import { extractVariableLabel } from '@/workflow/search-variables/utils/extractVariableLabel';
import styled from '@emotion/styled'; import styled from '@emotion/styled';
import { useId, useState } from 'react'; import { useId, useState } from 'react';
import { TEXT_INPUT_STYLE } from 'twenty-ui';
import { import {
canBeCastAsNumberOrNull, canBeCastAsNumberOrNull,
castAsNumberOrNull, castAsNumberOrNull,
@ -51,11 +51,8 @@ const StyledInputContainer2 = styled.div<{
width: 100%; width: 100%;
`; `;
const StyledInput = styled.input` const StyledInput = styled(TextInput)`
${TEXT_INPUT_STYLE}
padding: ${({ theme }) => `${theme.spacing(1)} ${theme.spacing(2)}`}; padding: ${({ theme }) => `${theme.spacing(1)} ${theme.spacing(2)}`};
width: 100%;
`; `;
const StyledVariableContainer = styled.div` const StyledVariableContainer = styled.div`
@ -137,11 +134,12 @@ export const FormNumberFieldInput = ({
<StyledInputContainer2> <StyledInputContainer2>
{editingMode === 'input' ? ( {editingMode === 'input' ? (
<StyledInput <StyledInput
type="text"
placeholder={placeholder} placeholder={placeholder}
value={draftValue} value={draftValue}
onChange={(event) => { copyButton={false}
handleChange(event.target.value); hotkeyScope="record-create"
onChange={(value) => {
handleChange(value);
}} }}
/> />
) : ( ) : (