Files
twenty_crm/front/src/modules/ui/input/text/components/TextInputEdit.tsx
gitstart-twenty 00a3c8ca2b Change to using arrow functions (#1603)
* Change to using arrow functions

Co-authored-by: v1b3m <vibenjamin6@gmail.com>
Co-authored-by: Matheus <matheus_benini@hotmail.com>

* Add lint rule

---------

Co-authored-by: v1b3m <vibenjamin6@gmail.com>
Co-authored-by: Matheus <matheus_benini@hotmail.com>
Co-authored-by: Charles Bochet <charles@twenty.com>
2023-09-15 18:41:10 -07:00

49 lines
1.1 KiB
TypeScript

import styled from '@emotion/styled';
import { textInputStyle } from '@/ui/theme/constants/effects';
import { overlayBackground } from '@/ui/theme/constants/effects';
const StyledInplaceInputTextInput = styled.input`
margin: 0;
width: 100%;
${textInputStyle}
`;
const StyledTextInputContainer = styled.div`
align-items: center;
border: 1px solid ${({ theme }) => theme.border.color.medium};
border-radius: ${({ theme }) => theme.border.radius.sm};
display: flex;
margin-left: -1px;
min-height: 32px;
width: inherit;
${overlayBackground}
z-index: 10;
`;
export type TextInputEditProps = {
placeholder?: string;
value?: string;
onChange?: (newValue: string) => void;
autoFocus?: boolean;
};
export const TextInputEdit = ({
placeholder,
value,
onChange,
autoFocus,
}: TextInputEditProps) => (
<StyledTextInputContainer>
<StyledInplaceInputTextInput
autoComplete="off"
autoFocus={autoFocus}
placeholder={placeholder}
value={value}
onChange={(e) => onChange?.(e.target.value)}
/>
</StyledTextInputContainer>
);