Footer.tsx 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. import React, { FC, useEffect } from 'react';
  2. import { connect } from 'react-redux';
  3. import styled from 'styled-components';
  4. import { Flex } from 'reflexbox/styled-components';
  5. import ReCaptcha from './ReCaptcha';
  6. import showRecaptcha from '../helpers/recaptcha';
  7. import { ifProp } from 'styled-tools';
  8. interface Props {
  9. isAuthenticated: boolean;
  10. }
  11. const Wrapper = styled(Flex).attrs({
  12. as: 'footer',
  13. width: 1,
  14. flexDirection: 'column',
  15. justifyContent: 'center',
  16. alignItems: 'center',
  17. })<Props>`
  18. padding: 4px 0 ${ifProp('isAuthenticated', '8px', '24px')};
  19. background-color: white;
  20. a {
  21. text-decoration: none;
  22. color: #2196f3;
  23. }
  24. `;
  25. const Text = styled.p`
  26. font-size: 13px;
  27. font-weight: 300;
  28. color: #666;
  29. @media only screen and (max-width: 768px) {
  30. font-size: 11px;
  31. }
  32. `;
  33. const Footer: FC<Props> = ({ isAuthenticated }) => {
  34. useEffect(() => {
  35. showRecaptcha();
  36. }, []);
  37. return (
  38. <Wrapper isAuthenticated={isAuthenticated}>
  39. {!isAuthenticated && <ReCaptcha />}
  40. <Text>
  41. Made with love by{' '}
  42. <a href="//thedevs.network/" title="The Devs">
  43. The Devs
  44. </a>
  45. .{' | '}
  46. <a
  47. href="https://github.com/thedevs-network/kutt"
  48. title="GitHub"
  49. target="_blank"
  50. >
  51. GitHub
  52. </a>
  53. {' | '}
  54. <a href="/terms" title="Terms of Service">
  55. Terms of Service
  56. </a>
  57. {' | '}
  58. <a href="/report" title="Report abuse">
  59. Report Abuse
  60. </a>
  61. {process.env.CONTACT_EMAIL && (
  62. <>
  63. {' | '}
  64. <a href={`mailto:${process.env.CONTACT_EMAIL}`} title="Contact us">
  65. Contact us
  66. </a>
  67. </>
  68. )}
  69. .
  70. </Text>
  71. </Wrapper>
  72. );
  73. };
  74. const mapStateToProps = ({ auth: { isAuthenticated } }) => ({
  75. isAuthenticated,
  76. });
  77. export default connect(mapStateToProps)(Footer);