url-info.tsx 975 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. import React from "react";
  2. import styled from "styled-components";
  3. import { Flex } from "reflexbox/styled-components";
  4. import { NextPage } from "next";
  5. import AppWrapper from "../components/AppWrapper";
  6. import Footer from "../components/Footer";
  7. import { H2, H4 } from "../components/Text";
  8. import { Col } from "../components/Layout";
  9. interface Props {
  10. linkTarget?: string;
  11. }
  12. const UrlInfoPage: NextPage<Props> = ({ linkTarget }) => {
  13. return (
  14. <AppWrapper>
  15. {!linkTarget ? (
  16. <H2 my={4} light>
  17. 404 | Link could not be found.
  18. </H2>
  19. ) : (
  20. <>
  21. <Col flex="1 1 100%" alignItems="center">
  22. <H2 my={3} light>
  23. Target:
  24. </H2>
  25. <H4 bold>{linkTarget}</H4>
  26. </Col>
  27. <Footer />
  28. </>
  29. )}
  30. </AppWrapper>
  31. );
  32. };
  33. UrlInfoPage.getInitialProps = async ctx => {
  34. return { linkTarget: (ctx?.req as any)?.linkTarget };
  35. };
  36. export default UrlInfoPage;