InfoForInput.tsx 955 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. // Copyright 2017-2020 @polkadot/react-components authors & contributors
  2. // This software may be modified and distributed under the terms
  3. // of the Apache-2.0 license. See the LICENSE file for details.
  4. import React from 'react';
  5. import styled from 'styled-components';
  6. import Labelled from './Labelled';
  7. interface Props {
  8. children: React.ReactNode;
  9. className?: string;
  10. type?: 'error' | 'info' | 'warning';
  11. }
  12. function InfoForInput ({ children, className = '', type = 'info' }: Props): React.ReactElement<Props> {
  13. return (
  14. <Labelled>
  15. <div className={`${className} ${type}`}>{children}</div>
  16. </Labelled>
  17. );
  18. }
  19. export default React.memo(styled(InfoForInput)`
  20. background: white;
  21. border-radius: 0 0 0.25rem 0.25rem;
  22. margin: -0.5rem 0 0.25rem;
  23. padding: 1.25rem 1.5rem 1rem;
  24. &.error {
  25. background: #db2828;
  26. color: #eee;
  27. }
  28. &.warning {
  29. background: #ffffe0;
  30. }
  31. > ul {
  32. margin: 0;
  33. padding: 0;
  34. }
  35. `);