mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-26 20:39:08 +01:00
a017a1bae0
* Added note to trader code fencing * Started adding code fences in signature-request * Finished code fencing * Improving code * adds check and runs prettier * Fixed storybook and code fences bundle * Added missing dependency * updates fences * fewer lines * undo previously merged PR * ran lavamoat auto * adds test * prettier --------- Co-authored-by: António Regadas <apregadas@gmail.com> Co-authored-by: Antonio Regadas <antonio.regadas@consensys.net> Co-authored-by: Brad Decker <bhdecker84@gmail.com>
56 lines
1.5 KiB
JavaScript
56 lines
1.5 KiB
JavaScript
import React from 'react';
|
|
import PropTypes from 'prop-types';
|
|
import {
|
|
DISPLAY,
|
|
FLEX_DIRECTION,
|
|
JustifyContent,
|
|
} from '../../../helpers/constants/design-system';
|
|
import { Label, Text } from '../../component-library';
|
|
import Box from '../../ui/box';
|
|
|
|
const NoteToTrader = (props) => {
|
|
const { placeholder, maxLength, onChange, noteText, labelText } = props;
|
|
|
|
return (
|
|
<Box className="confirm-page-container-content__data">
|
|
<Box display={DISPLAY.FLEX} flexDirection={FLEX_DIRECTION.ROW}>
|
|
<Box
|
|
className="note-header"
|
|
display={DISPLAY.FLEX}
|
|
justifyContent={JustifyContent.spaceBetween}
|
|
>
|
|
<Label htmlFor="transaction-note">{labelText}</Label>
|
|
<Text className="note-header__counter">
|
|
{noteText.length}/{maxLength}
|
|
</Text>
|
|
</Box>
|
|
<Box
|
|
display={DISPLAY.FLEX}
|
|
flexDirection={FLEX_DIRECTION.COLUMN}
|
|
className="note-field"
|
|
>
|
|
<textarea
|
|
id="transaction-note"
|
|
data-testid="transaction-note"
|
|
onChange={({ target: { value } }) => onChange(value)}
|
|
autoFocus
|
|
maxLength={maxLength}
|
|
placeholder={placeholder}
|
|
value={noteText}
|
|
/>
|
|
</Box>
|
|
</Box>
|
|
</Box>
|
|
);
|
|
};
|
|
|
|
NoteToTrader.propTypes = {
|
|
placeholder: PropTypes.string,
|
|
maxLength: PropTypes.string,
|
|
onChange: PropTypes.func,
|
|
noteText: PropTypes.string,
|
|
labelText: PropTypes.string,
|
|
};
|
|
|
|
export default NoteToTrader;
|