StatsError.js 838 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. import React from 'react';
  2. import PropTypes from 'prop-types';
  3. import styled from 'styled-components';
  4. const ErrorWrapper = styled.div`
  5. display: flex;
  6. justify-content: center;
  7. align-items: center;
  8. `;
  9. const ErrorMessage = styled.h3`
  10. font-size: 24px;
  11. font-weight: 300;
  12. @media only screen and (max-width: 768px) {
  13. font-size: 18px;
  14. }
  15. `;
  16. const Icon = styled.img`
  17. width: 24px;
  18. height: 24px;
  19. margin: 6px 12px 0 0;
  20. @media only screen and (max-width: 768px) {
  21. width: 18px;
  22. height: 18px;
  23. }
  24. `;
  25. const StatsError = ({ text }) => (
  26. <ErrorWrapper>
  27. <Icon src="/images/x.svg" />
  28. <ErrorMessage>{text || 'Could not get the short URL stats.'}</ErrorMessage>
  29. </ErrorWrapper>
  30. );
  31. StatsError.propTypes = {
  32. text: PropTypes.string,
  33. };
  34. StatsError.defaultProps = {
  35. text: '',
  36. };
  37. export default StatsError;