2023-03-16 12:26:00 +01:00
|
|
|
import React from 'react';
|
|
|
|
import PropTypes from 'prop-types';
|
|
|
|
import {
|
2023-07-05 12:00:15 +02:00
|
|
|
Display,
|
|
|
|
FlexDirection,
|
2023-03-16 12:26:00 +01:00
|
|
|
JustifyContent,
|
|
|
|
} from '../../../helpers/constants/design-system';
|
2023-07-18 17:15:25 +02:00
|
|
|
import { Label, Box, Text } from '../../component-library';
|
2023-03-16 12:26:00 +01:00
|
|
|
|
|
|
|
const NoteToTrader = (props) => {
|
|
|
|
const { placeholder, maxLength, onChange, noteText, labelText } = props;
|
|
|
|
|
|
|
|
return (
|
2023-05-16 17:44:08 +02:00
|
|
|
<Box className="confirm-page-container-content__data">
|
2023-07-05 12:00:15 +02:00
|
|
|
<Box
|
|
|
|
display={Display.Flex}
|
|
|
|
flexDirection={FlexDirection.Column}
|
|
|
|
padding={4}
|
|
|
|
>
|
2023-05-16 17:44:08 +02:00
|
|
|
<Box
|
|
|
|
className="note-header"
|
2023-07-05 12:00:15 +02:00
|
|
|
display={Display.Flex}
|
2023-05-16 17:44:08 +02:00
|
|
|
justifyContent={JustifyContent.spaceBetween}
|
|
|
|
>
|
|
|
|
<Label htmlFor="transaction-note">{labelText}</Label>
|
|
|
|
<Text className="note-header__counter">
|
|
|
|
{noteText.length}/{maxLength}
|
|
|
|
</Text>
|
|
|
|
</Box>
|
|
|
|
<Box
|
2023-07-05 12:00:15 +02:00
|
|
|
display={Display.Flex}
|
|
|
|
flexDirection={FlexDirection.Column}
|
2023-05-16 17:44:08 +02:00
|
|
|
className="note-field"
|
|
|
|
>
|
|
|
|
<textarea
|
|
|
|
id="transaction-note"
|
|
|
|
data-testid="transaction-note"
|
|
|
|
onChange={({ target: { value } }) => onChange(value)}
|
|
|
|
autoFocus
|
|
|
|
maxLength={maxLength}
|
|
|
|
placeholder={placeholder}
|
|
|
|
value={noteText}
|
|
|
|
/>
|
|
|
|
</Box>
|
2023-03-16 12:26:00 +01:00
|
|
|
</Box>
|
2023-05-16 17:44:08 +02:00
|
|
|
</Box>
|
2023-03-16 12:26:00 +01:00
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
NoteToTrader.propTypes = {
|
|
|
|
placeholder: PropTypes.string,
|
|
|
|
maxLength: PropTypes.string,
|
|
|
|
onChange: PropTypes.func,
|
|
|
|
noteText: PropTypes.string,
|
|
|
|
labelText: PropTypes.string,
|
|
|
|
};
|
|
|
|
|
|
|
|
export default NoteToTrader;
|