Advertisement
Guest User

Untitled

a guest
Dec 12th, 2019
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.84 KB | None | 0 0
  1. import styled, { css } from 'styled-components';
  2. import { COLORS } from '../../constants/colors';
  3. import { SHADOWS } from '../../constants/shadows';
  4.  
  5. interface IInput {
  6. isInvalid?: boolean;
  7. disabled?: boolean;
  8. sm?: boolean;
  9. lg?: boolean;
  10. noBorder?: boolean;
  11. noMaxWidth?: boolean;
  12. upperCase?: boolean;
  13. register?: boolean;
  14. autoComplete?: string;
  15. }
  16.  
  17. const Input = styled.input`
  18. padding: 5px 20px 5px 10px;
  19. max-width: 130px;
  20. border-radius: 4px;
  21. border: 1px solid ${COLORS.gray400};
  22. min-width: 150px;
  23.  
  24. &::placeholder {
  25. font-size: 14px;
  26. color: ${COLORS.gray500};
  27. }
  28.  
  29. &:focus {
  30. outline: none;
  31. border: 1px solid ${COLORS.green100};
  32. }
  33.  
  34. ${SHADOWS.extraSoft200};
  35.  
  36. ${({ disabled }: IInput) => disabled && DISABLED}
  37. ${({ sm }: IInput) => sm && SM}
  38. ${({ lg }: IInput) => lg && LG}
  39. ${({ noBorder }: IInput) => noBorder && NO_BORDER}
  40. ${({ noMaxWidth }: IInput) => noMaxWidth && NO_MAX_WIDTH}
  41. ${({ isInvalid }: IInput) => isInvalid && INVALID}
  42. ${({ upperCase }: IInput) => upperCase && UPPERCASE}
  43. ${({ register }: IInput) => register && REGISTER}
  44. `;
  45.  
  46. const INVALID = css`
  47. border-color: ${COLORS.red};
  48. `;
  49.  
  50. const NO_MAX_WIDTH = css`
  51. max-width: unset;
  52. width: 100%;
  53. `;
  54.  
  55. const DISABLED = css`
  56. cursor: not-allowed;
  57. background-color: ${COLORS.gray100};
  58. `;
  59. const SM = css`
  60. position: relative;
  61. width: 90px;
  62. padding: 2px 8px;
  63.  
  64. background-color: ${COLORS.white};
  65. color: ${COLORS.gray800};
  66.  
  67. border-radius: 4px;
  68.  
  69. font-size: 13px;
  70. min-width: unset;
  71. `;
  72.  
  73. const LG = css`
  74. height: 37px;
  75. font-size: 14px;
  76. `;
  77.  
  78. const NO_BORDER = css`
  79. border: 1px solid ${COLORS.transparent};
  80. `;
  81.  
  82. const UPPERCASE = css`
  83. text-transform: uppercase;
  84. `;
  85.  
  86. const REGISTER = css `
  87. width: 250px;
  88. `;
  89.  
  90. Input.displayName = 'Input';
  91.  
  92. export { Input };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement