styled.ts 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. import styled, { css } from 'styled-components';
  2. const baseStyles = css`
  3. border: 1.5px solid ${({ theme }) => theme.colors.black38};
  4. border-radius: 4px;
  5. padding: 7px 15px;
  6. outline: none;
  7. transition: border 200ms cubic-bezier(0, 0, 0.2, 1) 0ms;
  8. font-size: 1.2rem;
  9. box-sizing: border-box;
  10. :disabled {
  11. color: ${({ theme }) => theme.colors.black56};
  12. cursor: not-allowed;
  13. }
  14. `;
  15. export const Input = styled('input')<{
  16. error?: boolean;
  17. shouldFitContainer?: boolean;
  18. }>`
  19. ${baseStyles}
  20. width: ${props => (props.shouldFitContainer ? '100%' : 'auto')};
  21. ${props =>
  22. props.error
  23. ? css`
  24. border: 1.5px solid ${({ theme }) => theme.colors.error};
  25. `
  26. : css`
  27. :focus {
  28. border: 1.5px solid ${({ theme }) => theme.colors.primary};
  29. }
  30. `}
  31. `;
  32. export const TextArea = styled('textarea')<{
  33. error?: boolean;
  34. shouldFitContainer?: boolean;
  35. }>`
  36. ${baseStyles}
  37. height: 54px;
  38. width: ${props => (props.shouldFitContainer ? '100%' : 'auto')};
  39. ${props =>
  40. props.error
  41. ? css`
  42. border: 1.5px solid ${({ theme }) => theme.colors.error};
  43. `
  44. : css`
  45. :focus {
  46. border: 1.5px solid ${({ theme }) => theme.colors.primary};
  47. }
  48. `}
  49. `;