TextInput.js 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. import React from 'react';
  2. import PropTypes from 'prop-types';
  3. import styled, { css } from 'styled-components';
  4. import { fadeIn } from '../../helpers/animations';
  5. const LinkInput = styled.input`
  6. position: relative;
  7. width: auto;
  8. flex: 1 1 auto;
  9. height: 72px;
  10. padding: 0 84px 0 40px;
  11. font-size: 20px;
  12. letter-spacing: 0.05em;
  13. color: #444;
  14. box-sizing: border-box;
  15. background-color: white;
  16. box-shadow: 0 10px 35px rgba(50, 50, 50, 0.1);
  17. border-radius: 100px;
  18. border: none;
  19. border-bottom: 6px solid #f5f5f5;
  20. animation: ${fadeIn} 0.5s ease-out;
  21. transition: all 0.5s ease-out;
  22. :focus {
  23. outline: none;
  24. box-shadow: 0 20px 35px rgba(50, 50, 50, 0.2);
  25. }
  26. ::placeholder {
  27. font-size: 16px;
  28. letter-spacing: 0.1em;
  29. color: #888;
  30. }
  31. @media only screen and (max-width: 488px) {
  32. height: 56px;
  33. padding: 0 48px 0 32px;
  34. font-size: 14px;
  35. border-bottom-width: 5px;
  36. ::placeholder {
  37. font-size: 14px;
  38. }
  39. }
  40. ${({ small }) =>
  41. small &&
  42. css`
  43. width: 240px;
  44. height: 54px;
  45. margin-right: 32px;
  46. padding: 0 24px 2px;
  47. font-size: 18px;
  48. border-bottom: 4px solid #f5f5f5;
  49. ::placeholder {
  50. font-size: 13px;
  51. }
  52. @media only screen and (max-width: 448px) {
  53. width: 200px;
  54. height: 40px;
  55. padding: 0 16px 2px;
  56. font-size: 13px;
  57. border-bottom-width: 3px;
  58. }
  59. `};
  60. ${({ tiny }) =>
  61. tiny &&
  62. css`
  63. flex: 0 0 auto;
  64. width: 280px;
  65. height: 32px;
  66. margin: 0;
  67. padding: 0 16px 1px;
  68. font-size: 13px;
  69. border-bottom-width: 1px;
  70. border-radius: 4px;
  71. box-shadow: 0 4px 10px rgba(100, 100, 100, 0.1);
  72. :focus {
  73. box-shadow: 0 10px 25px rgba(50, 50, 50, 0.1);
  74. }
  75. ::placeholder {
  76. font-size: 12px;
  77. letter-spacing: 0;
  78. }
  79. @media only screen and (max-width: 768px) {
  80. width: 240px;
  81. height: 28px;
  82. }
  83. @media only screen and (max-width: 510px) {
  84. width: 180px;
  85. height: 24px;
  86. padding: 0 8px 1px;
  87. font-size: 12px;
  88. border-bottom-width: 3px;
  89. }
  90. `};
  91. ${({ height }) =>
  92. height &&
  93. css`
  94. height: ${height}px;
  95. `};
  96. `;
  97. const TextInput = props => <LinkInput {...props} />;
  98. TextInput.propTypes = {
  99. small: PropTypes.bool,
  100. tiny: PropTypes.bool,
  101. };
  102. TextInput.defaultProps = {
  103. small: false,
  104. tiny: false,
  105. };
  106. export default TextInput;