Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | 356x 356x 1x 156x 156x 156x 156x | import { ChangeEvent, ReactElement } from "react";
import styled from "styled-components";
interface Props {
className?: string;
onChange: (event: ChangeEvent<HTMLTextAreaElement>) => void;
rows?: number;
value: string;
placeholder?: string;
maxLength?: number;
disabled?: boolean;
}
const DEFAULT_ROW_COUNT = 4;
export const TextArea = ({
className,
onChange,
rows = DEFAULT_ROW_COUNT,
value,
placeholder,
maxLength,
disabled,
}: Props): ReactElement => {
return (
<StyledTextArea
className={className}
onChange={onChange}
rows={rows}
value={value}
placeholder={placeholder}
maxLength={maxLength}
disabled={disabled}
/>
);
};
const StyledTextArea = styled.textarea`
border: 1px solid ${(props) => props.theme.borderInactive};
resize: none;
overflow: auto;
border-radius: 6px;
&:focus {
/* Negative outline offset keeps the focus ring inside the element so it doesn't widen on focus */
border-color: ${(props) => props.theme.inputBorderFocus};
outline: 2px solid ${(props) => props.theme.inputBorderFocus};
outline-offset: -2px;
}
&::placeholder {
color: ${(props) => props.theme.inputTextPlaceholder};
}
`;
|