Skip to content
Snippets Groups Projects
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
Textarea.js 893 B
import { get } from 'lodash'
import { th } from '@pubsweet/ui-toolkit'
import styled, { css } from 'styled-components'

import { marginHelper } from '.'

const minHeight = props => css`
  min-height: calc(${th('gridUnit')} * ${get(props, 'minHeight', 2)});
`

const Textarea = styled.textarea`
  border-radius: ${th('borderRadius')};
  border-color: ${({ hasError }) =>
    hasError ? th('colorError') : th('colorFurniture')};
  font-size: ${th('fontSizeBase')};
  font-family: ${th('fontWriting')};
  padding: ${th('gridUnit')};
  width: 100%;
  resize: vertical;
  border-style: ${th('borderStyle')};
  border-width: ${th('borderWidth')};

  ${minHeight};
  ${marginHelper};

  &:focus,
  &:active {
    border-color: ${th('textField.activeBorder')};
    outline: none;
  }

  &:read-only {
    background-color: ${th('colorBackgroundHue')};
  }
`

/** @component */
export default Textarea