styled.ts 1.2 KB

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