styled.ts 833 B

1234567891011121314151617181920212223242526272829303132333435
  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. `;